Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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):
for elem in item:
self.chart.add(elem.chart, 1)
else:
raise Exception('CombinedPlot takes XYChart or List of XYChart')
self.model = self.chart.transform()
return self
self.categoryNamesLabelAngle = getValue(kwargs,
'categoryNamesLabelAngle', 0.0)
self.categoryNames = getValue(kwargs, 'categoryNames', [])
self.y_upper_margin = getValue(kwargs, 'upperMargin', 0.0)
self.y_lower_bound = getValue(kwargs, 'lowerMargin', 0.0)
self.x_upper_margin = getValue(kwargs, 'upperMargin', 0.05)
self.x_lower_margin = getValue(kwargs, 'lowerMargin', 0.05)
self.category_margin = getValue(kwargs, 'categoryMargin', 0.2)
self.y_auto_range_includes_zero = getValue(kwargs,
'y_auto_range_includes_zero',
False)
self.y_auto_range = getValue(kwargs, 'y_auto_range', True)
self.orientation = getValue(kwargs, 'orientation')
class TreeMapChart(XYChart):
def __init__(self, **kwargs):
super(TreeMapChart, self).__init__(**kwargs)
self.type = 'TreeMap'
self.showLegend = getValue(kwargs, 'showLegend', True)
self.title = getValue(kwargs, 'title', "")
self.colorProvider = getValue(kwargs, 'colorProvider',
RandomColorProvider())
self.toolTipBuilder = getValue(kwargs, 'toolTipBuilder')
self.mode = getValue(kwargs, 'mode', Mode.SQUARIFY).value
self.ratio = getValue(kwargs, 'ratio')
self.valueAccessor = getValue(kwargs, 'valueAccessor',
ValueAccessor.VALUE)
self.custom_styles = []
self.element_styles = {}
self.graphics_list = getValue(kwargs, 'root')
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
if not 'xUpperMargin' in kwargs:
kwargs['xUpperMargin'] = 0.0
if not 'legendLayout' in kwargs:
kwargs['legendLayout'] = LegendLayout.HORIZONTAL
if not 'legendPosition' in kwargs:
kwargs['legendPosition'] = LegendPosition(
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()
def __init__(self, **kwargs):
super(XYChart, self).__init__(**kwargs)
self.graphics_list = getValue(kwargs, 'graphics', [])
self.constant_lines = getValue(kwargs, 'constantLines', [])
self.constant_bands = getValue(kwargs, 'constantBands', [])
self.texts = getValue(kwargs, 'texts', [])
self.x_auto_range = getValue(kwargs, 'xAutoRange', True)
self.x_lower_bound = getValue(kwargs, 'xLowerBound', 0)
self.x_upper_bound = getValue(kwargs, 'xUpperBound', 0)
self.log_x = getValue(kwargs, 'logX', False)
self.x_log_base = getValue(kwargs, 'xLogBase', 10)
self.lodThreshold = getValue(kwargs, 'lodThreshold')
self.range_min = getValue(kwargs, 'rangeMin')
self.range_max = getValue(kwargs, 'rangeMax')
self.names = getValue(kwargs, 'names')
self.displayMode = getValue(kwargs, 'displayMode')
color = getValue(kwargs, 'color')
if color is not None:
if isinstance(color, Color):
self.colors = []
self.colors.append(color)
else:
self.colors = color
class CategoryChart(XYChart):
def __init__(self, **kwargs):
super(CategoryChart, self).__init__(**kwargs)
self.type = 'CategoryPlot'
self.categoryNamesLabelAngle = getValue(kwargs,
'categoryNamesLabelAngle', 0.0)
self.categoryNames = getValue(kwargs, 'categoryNames', [])
self.y_upper_margin = getValue(kwargs, 'upperMargin', 0.0)
self.y_lower_bound = getValue(kwargs, 'lowerMargin', 0.0)
self.x_upper_margin = getValue(kwargs, 'upperMargin', 0.05)
self.x_lower_margin = getValue(kwargs, 'lowerMargin', 0.05)
self.category_margin = getValue(kwargs, 'categoryMargin', 0.2)
self.y_auto_range_includes_zero = getValue(kwargs,
'y_auto_range_includes_zero',
False)
self.y_auto_range = getValue(kwargs, 'y_auto_range', True)
self.orientation = getValue(kwargs, 'orientation')
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, {})
return self
def setYBound(self, lower, upper):
self.y_lower_bound = lower
self.y_upper_bound = upper
self.rangeAxes[0].setBound(lower, upper)
return self
def setXBound(self, lower, upper):
self.x_auto_range = False
self.x_lower_bound = lower
self.x_upper_bound = upper
return self
class HistogramChart(XYChart):
def __init__(self, **kwargs):
self.log = getValue(kwargs, 'log', False)
if self.log:
kwargs['logY'] = True
super(HistogramChart, self).__init__(**kwargs)
self.type = 'Histogram'
self.bin_count = getValue(kwargs, 'binCount')
self.cumulative = getValue(kwargs, 'cumulative', False)
self.normed = getValue(kwargs, 'normed', False)
self.range_min = getValue(kwargs, 'rangeMin')
self.range_max = getValue(kwargs, 'rangeMax')
self.names = getValue(kwargs, 'names')
self.displayMode = getValue(kwargs, 'displayMode')