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 | 45 | pyglet.window.Window.__init__(self, resizable=True) |
| 46 | 46 | self.series = series |
| 47 | 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 | 49 | self.lines = (10, 8) |
| 50 | 50 | #self.resizable = True |
| 51 | 51 | self.set_caption(self.series.title) |
| ... | ... | @@ -88,30 +88,30 @@ class Plot(pyglet.window.Window): |
| 88 | 88 | if axis==0: # x axis, vertical lines |
| 89 | 89 | scale = float(self.series.xlimits[1]-self.series.xlimits[0])/(stop-start) |
| 90 | 90 | tagvalue = ((pos-start) * scale) + self.series.xlimits[0] |
| 91 | - tagtext = str(round(tagvalue, 1)) | |
| 91 | + tagtext = str(int(tagvalue)) | |
| 92 | 92 | pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (pos, limita, pos, limitb)), |
| 93 | 93 | ('c3B', (0, 0, 0, 0, 0, 0))) |
| 94 | 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 | 97 | anchor_x='left', anchor_y='top') |
| 98 | 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 | 100 | x=self.width/2, y=0, |
| 101 | 101 | anchor_x='center', anchor_y='bottom') |
| 102 | 102 | axistitle.draw() |
| 103 | 103 | if axis==1: # y axis, horizontal lines |
| 104 | 104 | scale = float(self.series.ylimits[1]-self.series.ylimits[0])/(stop-start) |
| 105 | 105 | tagvalue = ((pos-start) * scale) + self.series.ylimits[0] |
| 106 | - tagtext = str(round(tagvalue, 1)) | |
| 106 | + tagtext = str(int(tagvalue)) | |
| 107 | 107 | pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (limita, pos, limitb, pos)), |
| 108 | 108 | ('c3B', (0, 0, 0, 0, 0, 0))) |
| 109 | 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 | 112 | anchor_x='right', anchor_y='center') |
| 113 | 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 | 115 | x=0, y=self.height/2, |
| 116 | 116 | anchor_x='center', anchor_y='top') |
| 117 | 117 | pyglet.gl.glPushMatrix() # Set up a new context to avoid confusing the main one | ... | ... |