How to use the beakerx.beakerx.plot.plotitem.Graphics function in beakerx

To help you get started, we’ve selected a few beakerx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twosigma / beakerx / beakerx / beakerx / plot / plotitem.py View on Github external
current.bases = previousYs
                stackedList.append(current)

            return stackedList


class Crosshair(BasedXYGraphics):
    def __init__(self, *args, **kwargs):
        super(Crosshair, self).__init__(*args, **kwargs)
        self.width = getValue(kwargs, 'width')
        self.style = getValue(kwargs, 'style')
        self.color = getColor(getValue(kwargs, 'color'))


class CategoryGraphics(Graphics):
    def __init__(self, **kwargs):
        super(CategoryGraphics, self).__init__(**kwargs)
        self.center_series = getValue(kwargs, 'centerSeries', False)
        self.use_tool_tip = getValue(kwargs, 'useToolTip', True)
        self.showItemLabel = getValue(kwargs, 'showItemLabel', False)
        self.outline = getValue(kwargs, 'outline', False)
        self.labelPosition = getValue(kwargs, 'labelPosition', "CENTER")
        self.fills = getValue(kwargs, 'fill')
        self.itemLabels = getValue(kwargs, 'itemLabel')
        self.seriesNames = getValue(kwargs, 'seriesNames')
        self.style = getValue(kwargs, 'style')
        self.size = getValue(kwargs, 'size')

        outline = getValue(kwargs, 'outlineColor')
        if isinstance(outline, list):
            self.outline_colors = outline
github twosigma / beakerx / beakerx / beakerx / plot / plotitem.py View on Github external
def onKey(self, key, on_key):
        if isinstance(on_key, str):
            self.keyTags[key] = on_key
        else:
            self.onKeyListeners[key] = on_key
        if key not in self.keys:
            self.keys.append(key)
        return self

    def fireClick(self, details):
        self.onClickListeners(details)

    def fireKey(self, details, key):
        self.onKeyListeners.get(key, lambda *args: None)(details)

class ConstantLine(Graphics):
    def __init__(self, **kwargs):
        super(ConstantLine, self).__init__(**kwargs)
        self.x = getValue(kwargs, 'x')
        self.y = getValue(kwargs, 'y')
        self.color = getColor(getValue(kwargs, 'color'))
        self.width = getValue(kwargs, 'width', 1.5)
        self.style = getValue(kwargs, 'style')
        self.showLabel = getValue(kwargs, 'showLabel')


class ConstantBand(Graphics):
    def __init__(self, **kwargs):
        super(ConstantBand, self).__init__(**kwargs)
        self.x = getValue(kwargs, 'x')
        self.y = getValue(kwargs, 'y')
        self.color = getColor(
github twosigma / beakerx / beakerx / beakerx / plot / plotitem.py View on Github external
def fireKey(self, details, key):
        self.onKeyListeners.get(key, lambda *args: None)(details)

class ConstantLine(Graphics):
    def __init__(self, **kwargs):
        super(ConstantLine, self).__init__(**kwargs)
        self.x = getValue(kwargs, 'x')
        self.y = getValue(kwargs, 'y')
        self.color = getColor(getValue(kwargs, 'color'))
        self.width = getValue(kwargs, 'width', 1.5)
        self.style = getValue(kwargs, 'style')
        self.showLabel = getValue(kwargs, 'showLabel')


class ConstantBand(Graphics):
    def __init__(self, **kwargs):
        super(ConstantBand, self).__init__(**kwargs)
        self.x = getValue(kwargs, 'x')
        self.y = getValue(kwargs, 'y')
        self.color = getColor(
            getValue(kwargs, 'color', Color(0, 127, 255, 127)))


def is_date(string):
    try:
        parse(string)
        return True
    except Exception:
        return False
github twosigma / beakerx / beakerx / beakerx / plot / plotitem.py View on Github external
def __init__(self, **kwargs):
        super(Graphics, self).__init__(**kwargs)
        self.type = self.__class__.__name__
        self.visible = getValue(kwargs, 'visible', True)
        self.yAxis = getValue(kwargs, 'yAxis')
        self.clickTag = getValue(kwargs, 'tag', "")
        self.hasClickAction = self.clickTag != ""
        self.uid = str(uuid.uuid4())
        self.onClickListeners = lambda *args: None
        self.onKeyListeners = {}
        self.keyTags = {}
        self.keys = []
github twosigma / beakerx / beakerx / beakerx / plot / plotitem.py View on Github external
super(ConstantBand, self).__init__(**kwargs)
        self.x = getValue(kwargs, 'x')
        self.y = getValue(kwargs, 'y')
        self.color = getColor(
            getValue(kwargs, 'color', Color(0, 127, 255, 127)))


def is_date(string):
    try:
        parse(string)
        return True
    except Exception:
        return False


class XYGraphics(Graphics):
    def __init__(self, *args, **kwargs):
        super(XYGraphics, self).__init__(**kwargs)
        if len(args) > 0 and isinstance(args[0], pd.Series):
            defX = args[0].index.tolist()
            defY = args[0].tolist()
        else:
            defY = getValue(kwargs, 'y')

            if defY is not None:
                if isinstance(defY, pd.Series) or isinstance(defY, np.ndarray):
                    defY = defY.tolist()
                defX = list(range(0, len(defY)))
            else:
                defX = []

        local_x = getValue(kwargs, 'x', defX)