Commit d7138d89aff04b2775a2996f5c25b9f22589466b
1 parent
5ee0c27d
Exists in
master
Added basis for line-drawing function, big comment on plans for multiline graphs
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
telemetry/code/monitor/graph_plotter_rewrite.py
| ... | ... | @@ -26,6 +26,16 @@ timeout=1 |
| 26 | 26 | class Series: |
| 27 | 27 | def __init__(self, points=100, title="Series title", xname="x-axis name", yname="y-axis name"): |
| 28 | 28 | """Set up an object to store a 2D data series""" |
| 29 | + # Proposal: | |
| 30 | + # In order to neatly handle multiple lines on the same graph | |
| 31 | + # a series is not so much a set of 2D data points, but a number | |
| 32 | + # of series sharing an x axis. For example | |
| 33 | + # (time, temperature) | |
| 34 | + # (time, xaccel, yaccel, zaccel) | |
| 35 | + # The latter seta of points much be of like nature and share an axis | |
| 36 | + # (time, temperature, xaccel) | |
| 37 | + # would be a meaningless thing to plot on a single graph anyway | |
| 38 | + | |
| 29 | 39 | self.title = title |
| 30 | 40 | self.xname = xname |
| 31 | 41 | self.yname = yname |
| ... | ... | @@ -74,6 +84,10 @@ class Plot(pyglet.window.Window): |
| 74 | 84 | x=self.width/2, y=self.height-(self.margins[1]), |
| 75 | 85 | anchor_x='center', anchor_y='top') |
| 76 | 86 | heading.draw() |
| 87 | + | |
| 88 | + def drawLine(self): | |
| 89 | + for point in self.series.data: | |
| 90 | + pass | |
| 77 | 91 | |
| 78 | 92 | def drawAxis(self, axis): # axis=0 is x, 1 is y |
| 79 | 93 | """Draw the gridlines and labels for one axis, specified in the last argument""" | ... | ... |