1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- '''
- Created on May 15, 2017
- @author: Bart
- '''
- from serializable import Serializable
- class Plot(Serializable):
- def __init__(self, datasets, title=None, x=None, y=None, legend=None):
- self.title = title
- if x == None:
- x = Axis()
- self.x = x
- if y == None:
- y = Axis()
- self.y = y
- if legend == None:
- # we set legend to true in case of a multiplot where all legend entries are defined
- legend = len(datasets) > 1 and all(map(lambda d : d.legend, datasets))
- self.legend = legend
- self.datasets = datasets
-
-
- class DataSet(Serializable):
- def __init__(self, datapoints, color=None, linestyle=None, legend=None):
- self.color = color
- self.linestyle = linestyle
- self.datapoints = datapoints
- self.legend = legend
- class DataPoint(Serializable):
-
- def __init__(self, x, y):
- self.x = x
- self.y = y
-
-
- class Color:
- # enumeration of all colors
- BLUE, GREEN, RED, CYAN, MAGENTA, YELLOW, BLACK, WHITE = range(8)
- class LineStyle:
- # enumeration of all line styles
- SOLID, DASHED, DASHDOT, DOTTED, PIXEL, POINT, CIRCLE, STAR, PLUS, X = range(10)
-
- class Axis(Serializable):
-
- def __init__(self, name=None, unit=None, lim_low=None, lim_high=None):
- if not name:
- name = ""
- self.name = name
- if not unit:
- unit = ""
- self.unit = unit
- self.lim_low = lim_low
- self.lim_high = lim_high
- class XAxis(Axis): pass
- class YAxis(Axis): pass
-
|