Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def limit_elements_in_row(listOfData):
return list(map(HeatMapChart.limit_column_in_row, listOfData))
def limit_Heatmap(listOfData):
limited_elements_in_row = HeatMapChart.limit_elements_in_row(listOfData)
total_points = HeatMapChart.total_points(limited_elements_in_row)
too_many_rows = total_points > HeatMapChart.ROWS_LIMIT
if too_many_rows:
return HeatMapChart.limit_rows(limited_elements_in_row)
return limited_elements_in_row
def limit_Heatmap(listOfData):
limited_elements_in_row = HeatMapChart.limit_elements_in_row(listOfData)
total_points = HeatMapChart.total_points(limited_elements_in_row)
too_many_rows = total_points > HeatMapChart.ROWS_LIMIT
if too_many_rows:
return HeatMapChart.limit_rows(limited_elements_in_row)
return limited_elements_in_row
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.rows_limit = rows_limit
self.column_limit = column_limit
self.chart = HeatMapChart(self.rows_limit, self.column_limit, **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 limit_Heatmap(listOfData):
limited_elements_in_row = HeatMapChart.limit_elements_in_row(listOfData)
total_points = HeatMapChart.total_points(limited_elements_in_row)
too_many_rows = total_points > HeatMapChart.ROWS_LIMIT
if too_many_rows:
return HeatMapChart.limit_rows(limited_elements_in_row)
return limited_elements_in_row
def __init__(self, rows_limit, column_limit, **kwargs):
super(HeatMapChart, self).__init__(**kwargs)
self.rows_limit = rows_limit
self.column_limit = column_limit
def find_step_for_column(row):
step = 2
while (int(len(row) / step)) > HeatMapChart.COLUMN_LIMIT:
step += 1
return step
def limit_column_in_row(row):
if len(row) > HeatMapChart.COLUMN_LIMIT:
step = HeatMapChart.find_step_for_column(row)
limited_row = list(map(lambda index: row[index],
filter(lambda s: s % step == 0,
[index for index in range(len(row))])))
return limited_row
else:
return row
def limit_Heatmap(listOfData):
limited_elements_in_row = HeatMapChart.limit_elements_in_row(listOfData)
total_points = HeatMapChart.total_points(limited_elements_in_row)
too_many_rows = total_points > HeatMapChart.ROWS_LIMIT
if too_many_rows:
return HeatMapChart.limit_rows(limited_elements_in_row)
return limited_elements_in_row