Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, **kwargs):
super(TimePlot, self).__init__(**kwargs)
self.chart.type = 'TimePlot'
for i in range(len(columnNames)):
if i < len(colors):
chartColors.append(self.createChartColor(colors[i]))
return chartColors
def createChartColor(self, color):
if isinstance(color, list):
try:
return Color(color[0], color[1], color[2])
except Exception:
raise Exception("Color list too short")
else:
return color
class NanoPlot(TimePlot):
def __init__(self, **kwargs):
super(NanoPlot, self).__init__(**kwargs)
self.chart.type = 'NanoPlot'
def add(self, item):
super(NanoPlot, self).add(item)
for l in self.chart.graphics_list:
converted = []
for x in l.x:
converted.append(str(x))
l.x = converted
self.model = self.chart.transform()
return self
class SimpleTimePlot(TimePlot):
def add(self, item):
super(NanoPlot, self).add(item)
for l in self.chart.graphics_list:
convertedx = []
convertedy = []
for x in l.x:
convertedx.append(str(x))
l.x = convertedx
for y in l.y:
convertedy.append(str(y))
l.y = convertedy
self.model = self.chart.transform()
return self
class SimpleTimePlot(TimePlot):
def __init__(self, *args, **kwargs):
super(SimpleTimePlot, self).__init__(**kwargs)
self.chart.type = 'TimePlot'
self.use_tool_tip = True
self.show_legend = True
time_column_default = 'time'
displayNames = getValue(kwargs, 'displayNames')
displayLines = getValue(kwargs, 'displayLines', True)
displayPoints = getValue(kwargs, 'displayPoints', False)
colors = getValue(kwargs, 'colors')
if len(args) > 0:
tableData = args[0]
else:
tableData = []
def __init__(self, **kwargs):
super(NanoPlot, self).__init__(**kwargs)
self.chart.type = 'NanoPlot'
def add(self, item):
super(NanoPlot, self).add(item)
for l in self.chart.graphics_list:
converted = []
for x in l.x:
converted.append(str(x))
l.x = converted
self.model = self.chart.transform()
return self
class SimpleTimePlot(TimePlot):
def __init__(self, *args, **kwargs):
super(SimpleTimePlot, self).__init__(**kwargs)
self.chart.type = 'TimePlot'
self.use_tool_tip = True
self.show_legend = True
time_column_default = 'time'
displayNames = getValue(kwargs, 'displayNames')
displayLines = getValue(kwargs, 'displayLines', True)
displayPoints = getValue(kwargs, 'displayPoints', False)
colors = getValue(kwargs, 'colors')
if len(args) > 0:
tableData = args[0]
else:
tableData = []
for i in range(len(columnNames)):
if i < len(colors):
chartColors.append(self.createChartColor(colors[i]))
return chartColors
def createChartColor(self, color):
if isinstance(color, list):
try:
return Color(color[0], color[1], color[2])
except Exception:
raise Exception("Color list too short")
else:
return color
class NanoPlot(TimePlot):
def __init__(self, **kwargs):
super(NanoPlot, self).__init__(**kwargs)
self.chart.type = 'NanoPlot'
def add(self, item):
super(NanoPlot, self).add(item)
for l in self.chart.graphics_list:
convertedx = []
convertedy = []
for x in l.x:
convertedx.append(str(x))
l.x = convertedx
for y in l.y:
convertedy.append(str(y))
l.y = convertedy
self.model = self.chart.transform()
def __init__(self, **kwargs):
super(TimePlot, self).__init__(**kwargs)
self.chart.type = 'TimePlot'