Commit 6496fcef authored by Mihai Baltac's avatar Mihai Baltac
Browse files

added showlegend attribute in cartesians

parent 67e78f7b
......@@ -4,14 +4,16 @@ from scatter_plot import ScatterPlot
class Cartesian(ScatterPlot):
def __init__(self, x, y, label, line, marker):
def __init__(self, x, y, label, line, marker, showlegend=True):
super(Cartesian, self).__init__(label, line, marker)
self.x = x
self.y = y
self.showlegend = showlegend
@abstractmethod
def to_plotly(self):
plotly_object = super(Cartesian, self).to_plotly()
plotly_object['x'] = self.x
plotly_object['y'] = self.y
plotly_object['showlegend'] = self.showlegend
return plotly_object
......@@ -5,12 +5,12 @@ from cartesian import Cartesian
class Cartesian2D(Cartesian):
def __init__(self, x=None, y=None, x_start=0, x_step=1,
label='', line=None, marker=None, webgl=True):
label='', line=None, marker=None, showlegend=True, webgl=True):
if y is None:
raise Exception('Error: no y data to plot')
if x is None:
x = range(x_start, len(y) * x_step, x_step)
super(Cartesian2D, self).__init__(x, y, label, line, marker)
super(Cartesian2D, self).__init__(x, y, label, line, marker, showlegend)
self.webgl = webgl
def to_plotly(self):
......
......@@ -4,8 +4,8 @@ from cartesian import Cartesian
class Cartesian3D(Cartesian):
def __init__(self, x, y, z, label='', line=None, marker=None):
super(Cartesian3D, self).__init__(x, y, label, line, marker)
def __init__(self, x, y, z, label='', line=None, marker=None, showlegend=True):
super(Cartesian3D, self).__init__(x, y, label, line, marker, showlegend)
self.z = z
def to_plotly(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment