How to use the beakerx.beakerx_widgets.BeakerxDOMWidget 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 / chart.py View on Github external
if displayPoints is True:
                    points = Points(x=xs, y=ys)
                    
                    if displayNames is not None and i < len(displayNames):
                        points.display_name = displayNames[i]
                    else:
                        points.display_name = columnNames[i]
                    
                    if i < len(colors):
                        points.color = colors[i]
                    
                    self.add(points)


class CombinedPlot(BeakerxDOMWidget):
    _view_name = Unicode('PlotView').tag(sync=True)
    _model_name = Unicode('PlotModel').tag(sync=True)
    _view_module = Unicode('beakerx').tag(sync=True)
    _model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(CombinedPlot, self).__init__(**kwargs)
        self.chart = CombinedChart(**kwargs)
        self.model = self.chart.transform()

    def add(self, item, weight):
        if isinstance(item.chart, XYChart):
            self.chart.plots.append(item.chart)
            self.chart.weights.append(weight)
        elif isinstance(item, list):
github twosigma / beakerx / beakerx / beakerx / plot / chart.py View on Github external
position=LegendPosition.Position.BOTTOM_RIGHT)
        self.chart = XYChart(**kwargs)
        color = getValue(kwargs, 'color',
                         ["#FF780004", "#FFF15806", "#FFFFCE1F"])
        
        if isinstance(color, GradientColor):
            self.chart.color = color.color
        else:
            self.chart.color = color
        
        self.chart.type = 'HeatMap'

        self.model = self.chart.transform()


class Histogram(BeakerxDOMWidget):
    class DisplayMode(Enum):
        OVERLAP = 1
        STACK = 2
        SIDE_BY_SIDE = 3
    
    _view_name = Unicode('PlotView').tag(sync=True)
    _model_name = Unicode('PlotModel').tag(sync=True)
    _view_module = Unicode('beakerx').tag(sync=True)
    _model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(Histogram, self).__init__()
        self.chart = HistogramChart(**kwargs)
        data = getValue(kwargs, 'data', [])
        if len(data) > 1 and isinstance(data[0], list):
github twosigma / beakerx / beakerx / beakerx / plot / chart.py View on Github external
def __init__(self, **kwargs):
        super(CategoryPlot, self).__init__(**kwargs)
        self.chart = CategoryChart(**kwargs)
        self.model = self.chart.transform()

    def add(self, item):
        self.chart.add(item)
        self.model = self.chart.transform()
        return self

    def _ipython_display_(self, **kwargs):
        self.model = self.chart.transform()
        super(CategoryPlot, self)._ipython_display_(**kwargs)

class HeatMap(BeakerxDOMWidget):
    _view_name = Unicode('PlotView').tag(sync=True)
    _model_name = Unicode('PlotModel').tag(sync=True)
    _view_module = Unicode('beakerx').tag(sync=True)
    _model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(HeatMap, self).__init__(**kwargs)
        if 'data' in kwargs:
            kwargs['graphics'] = kwargs['data']
        if not 'xLowerMargin' in kwargs:
            kwargs['xLowerMargin'] = 0.0
        if not 'yLowerMargin' in kwargs:
            kwargs['yLowerMargin'] = 0.0
        if not 'yUpperMargin' in kwargs:
            kwargs['yUpperMargin'] = 0.0
github twosigma / beakerx / beakerx / beakerx / plot / chart.py View on Github external
arguments = dict(target_name='beakerx.tag.run')
            comm = Comm(**arguments)
            msg = {'runByTag': params['params']['tag']}
            state = {'state': msg}
            comm.send(data=state, buffers=[])

class GraphicsActionObject:
    def __init__(self, graphics_object, params):
        self.graphics = graphics_object
        self.key = params.get('key')
        self.tag = params.get('tag')
        self.index = params.get('index')
        self.actionType = params.get('actionType')


class CategoryPlot(BeakerxDOMWidget):
    _view_name = Unicode('PlotView').tag(sync=True)
    _model_name = Unicode('PlotModel').tag(sync=True)
    _view_module = Unicode('beakerx').tag(sync=True)
    _model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(CategoryPlot, self).__init__(**kwargs)
        self.chart = CategoryChart(**kwargs)
        self.model = self.chart.transform()

    def add(self, item):
        self.chart.add(item)
        self.model = self.chart.transform()
        return self
github twosigma / beakerx / beakerx / beakerx / plot / chart.py View on Github external
_model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(Histogram, self).__init__()
        self.chart = HistogramChart(**kwargs)
        data = getValue(kwargs, 'data', [])
        if len(data) > 1 and isinstance(data[0], list):
            for x in data:
                self.chart.graphics_list.append(x)
        else:
            self.chart.graphics_list.append(data)
        self.model = self.chart.transform()


class TreeMap(BeakerxDOMWidget):
    _view_name = Unicode('PlotView').tag(sync=True)
    _model_name = Unicode('PlotModel').tag(sync=True)
    _view_module = Unicode('beakerx').tag(sync=True)
    _model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(TreeMap, self).__init__()
        self.chart = TreeMapChart(**kwargs)
        self.model = self.chart.transform()

    def setColorProvider(self, provider):
        self.chart.colorProvider = provider
        self.model = self.chart.transform()
github twosigma / beakerx / beakerx / beakerx / plot / chart.py View on Github external
super(CombinedChart, self).__init__(**kwargs)
        self.init_width = getValue(kwargs, 'initWidth', 640)
        self.init_height = getValue(kwargs, 'initHeight', 480)
        self.title = getValue(kwargs, 'title')
        self.x_label = getValue(kwargs, 'xLabel', 'Linear')
        self.plots = getValue(kwargs, 'plots', [])
        self.weights = getValue(kwargs, 'weights', [])
        self.auto_zoom = getValue(kwargs, 'autoZoom')
        self.version = 'groovy'
        self.type = 'CombinedPlot'
        self.y_tickLabels_visible = True
        self.x_tickLabels_visible = True
        self.plot_type = 'Plot'


class Plot(BeakerxDOMWidget):
    _view_name = Unicode('PlotView').tag(sync=True)
    _model_name = Unicode('PlotModel').tag(sync=True)
    _view_module = Unicode('beakerx').tag(sync=True)
    _model_module = Unicode('beakerx').tag(sync=True)
    model = Dict().tag(sync=True)
    
    def __init__(self, **kwargs):
        super(Plot, self).__init__(**kwargs)
        self.chart = XYChart(**kwargs)
        self.model = self.chart.transform()
        self.on_msg(self._handle_msg)
        self.details = GraphicsActionObject(None, {})

    def add(self, item):
        self.chart.add(item)
        self.model = self.chart.transform()