Commit 5ee0c27d095536687de28718b6509302b6c13062
1 parent
da8741ed
Exists in
master
Cleaned up axis tag sizes and formatting. Using integers for the moment to save …
…space. Not many real values to be displayed with be fractional
Showing
1 changed file
with
9 additions
and
9 deletions
Show diff stats
telemetry/code/monitor/graph_plotter_rewrite.py
| @@ -45,7 +45,7 @@ class Plot(pyglet.window.Window): | @@ -45,7 +45,7 @@ class Plot(pyglet.window.Window): | ||
| 45 | pyglet.window.Window.__init__(self, resizable=True) | 45 | pyglet.window.Window.__init__(self, resizable=True) |
| 46 | self.series = series | 46 | self.series = series |
| 47 | self.font = 'Arkhip' | 47 | self.font = 'Arkhip' |
| 48 | - self.margins = (0.1, 0.08) # Fractions of window size | 48 | + self.margins = (0.09, 0.08) # Fractions of window size |
| 49 | self.lines = (10, 8) | 49 | self.lines = (10, 8) |
| 50 | #self.resizable = True | 50 | #self.resizable = True |
| 51 | self.set_caption(self.series.title) | 51 | self.set_caption(self.series.title) |
| @@ -88,30 +88,30 @@ class Plot(pyglet.window.Window): | @@ -88,30 +88,30 @@ class Plot(pyglet.window.Window): | ||
| 88 | if axis==0: # x axis, vertical lines | 88 | if axis==0: # x axis, vertical lines |
| 89 | scale = float(self.series.xlimits[1]-self.series.xlimits[0])/(stop-start) | 89 | scale = float(self.series.xlimits[1]-self.series.xlimits[0])/(stop-start) |
| 90 | tagvalue = ((pos-start) * scale) + self.series.xlimits[0] | 90 | tagvalue = ((pos-start) * scale) + self.series.xlimits[0] |
| 91 | - tagtext = str(round(tagvalue, 1)) | 91 | + tagtext = str(int(tagvalue)) |
| 92 | pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (pos, limita, pos, limitb)), | 92 | pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (pos, limita, pos, limitb)), |
| 93 | ('c3B', (0, 0, 0, 0, 0, 0))) | 93 | ('c3B', (0, 0, 0, 0, 0, 0))) |
| 94 | tag = pyglet.text.Label(tagtext, color=BLACK, | 94 | tag = pyglet.text.Label(tagtext, color=BLACK, |
| 95 | - font_name=self.font, font_size=self.height*self.margins[1-axis]*0.28, | ||
| 96 | - x=pos, y=self.height*self.margins[1-axis], | 95 | + font_name=self.font, font_size=self.height*self.margins[1]*0.3, |
| 96 | + x=pos, y=self.height*self.margins[1], | ||
| 97 | anchor_x='left', anchor_y='top') | 97 | anchor_x='left', anchor_y='top') |
| 98 | axistitle = pyglet.text.Label(self.series.xname, color=BLACK, | 98 | axistitle = pyglet.text.Label(self.series.xname, color=BLACK, |
| 99 | - font_name=self.font, font_size=self.height*self.margins[axis]*0.3, | 99 | + font_name=self.font, font_size=self.height*self.margins[1]*0.3, |
| 100 | x=self.width/2, y=0, | 100 | x=self.width/2, y=0, |
| 101 | anchor_x='center', anchor_y='bottom') | 101 | anchor_x='center', anchor_y='bottom') |
| 102 | axistitle.draw() | 102 | axistitle.draw() |
| 103 | if axis==1: # y axis, horizontal lines | 103 | if axis==1: # y axis, horizontal lines |
| 104 | scale = float(self.series.ylimits[1]-self.series.ylimits[0])/(stop-start) | 104 | scale = float(self.series.ylimits[1]-self.series.ylimits[0])/(stop-start) |
| 105 | tagvalue = ((pos-start) * scale) + self.series.ylimits[0] | 105 | tagvalue = ((pos-start) * scale) + self.series.ylimits[0] |
| 106 | - tagtext = str(round(tagvalue, 1)) | 106 | + tagtext = str(int(tagvalue)) |
| 107 | pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (limita, pos, limitb, pos)), | 107 | pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (limita, pos, limitb, pos)), |
| 108 | ('c3B', (0, 0, 0, 0, 0, 0))) | 108 | ('c3B', (0, 0, 0, 0, 0, 0))) |
| 109 | tag = pyglet.text.Label(tagtext, color=BLACK, | 109 | tag = pyglet.text.Label(tagtext, color=BLACK, |
| 110 | - font_name=self.font, font_size=self.width*self.margins[axis]*0.22, | ||
| 111 | - x=self.width*self.margins[1-axis]*0.9, y=pos, | 110 | + font_name=self.font, font_size=self.width*self.margins[0]*0.2, |
| 111 | + x=self.width*self.margins[0]*0.9, y=pos, | ||
| 112 | anchor_x='right', anchor_y='center') | 112 | anchor_x='right', anchor_y='center') |
| 113 | axistitle = pyglet.text.Label(self.series.yname, color=BLACK, | 113 | axistitle = pyglet.text.Label(self.series.yname, color=BLACK, |
| 114 | - font_name=self.font, font_size=self.height*self.margins[axis]*0.3, | 114 | + font_name=self.font, font_size=self.height*self.margins[0]*0.3, |
| 115 | x=0, y=self.height/2, | 115 | x=0, y=self.height/2, |
| 116 | anchor_x='center', anchor_y='top') | 116 | anchor_x='center', anchor_y='top') |
| 117 | pyglet.gl.glPushMatrix() # Set up a new context to avoid confusing the main one | 117 | pyglet.gl.glPushMatrix() # Set up a new context to avoid confusing the main one |