Commit 6dbc3a2cee0df00747d649de1aa14d3f28760974

Authored by Christopher Stone
1 parent d9082b1e
Exists in master

fixed line coordintes

telemetry/code/monitor/.graph_plotter_rewrite.py.kate-swp deleted
No preview for this file type
telemetry/code/monitor/graph_plotter_rewrite.py
@@ -35,16 +35,15 @@ class Plot(pyglet.window.Window): @@ -35,16 +35,15 @@ class Plot(pyglet.window.Window):
35 self.series = series 35 self.series = series
36 self.title = self.series.title 36 self.title = self.series.title
37 self.font = 'Arkhip' 37 self.font = 'Arkhip'
38 - self.margins = (0.02, 0.02) # Fractions of window size 38 + self.margins = (0.05, 0.05) # Fractions of window size
39 self.lines = (12, 8) 39 self.lines = (12, 8)
40 #self.resizable = True 40 #self.resizable = True
41 self.set_caption(self.title) 41 self.set_caption(self.title)
  42 +
  43 + def on_resize(self, width, height):
42 self.bounds = ((int(self.width * self.margins[0]), int(self.width * (1 - self.margins[0]))), 44 self.bounds = ((int(self.width * self.margins[0]), int(self.width * (1 - self.margins[0]))),
43 - (int(self.height * self.margins[1]), int(self.height * (1 - self.margins[1]))))  
44 -  
45 - #def on_resize(self, width, height):  
46 - """Handle a pyglet resize event"""  
47 - # pass 45 + (int(self.height * self.margins[1]), int(self.height * (1 - self.margins[1]))))
  46 + pyglet.window.Window.on_resize(self, width, height)
48 47
49 def on_draw(self): 48 def on_draw(self):
50 """Draw all the components of the graph""" 49 """Draw all the components of the graph"""
@@ -59,13 +58,13 @@ class Plot(pyglet.window.Window): @@ -59,13 +58,13 @@ class Plot(pyglet.window.Window):
59 def drawHeading(self): 58 def drawHeading(self):
60 """Draw a title for the graph (duplicated in the window titlebar, if present""" 59 """Draw a title for the graph (duplicated in the window titlebar, if present"""
61 heading = pyglet.text.Label(self.title, color=BLACK, 60 heading = pyglet.text.Label(self.title, color=BLACK,
62 - font_name=self.font, font_size=self.width*self.margins[0], x=self.width/2, y=self.height, 61 + font_name=self.font, font_size=self.height*self.margins[0]*0.8, x=self.width/2, y=self.height,
63 anchor_x='center', anchor_y='top') 62 anchor_x='center', anchor_y='top')
64 heading.draw() 63 heading.draw()
65 64
66 def drawXAxis(self): 65 def drawXAxis(self):
67 pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (self.bounds[0][0], self.bounds[1][0], 66 pyglet.graphics.draw(2, pyglet.gl.GL_LINES, ('v2i', (self.bounds[0][0], self.bounds[1][0],
68 - self.bounds[1][0], self.bounds[1][1])), 67 + self.bounds[0][0], self.bounds[1][1])),
69 ('c3B', (0, 0, 0, 0, 0, 0))) 68 ('c3B', (0, 0, 0, 0, 0, 0)))
70 69
71 70