Draw basic direction legends at the top and bottom of graph
This commit is contained in:
parent
df0b885447
commit
0eecc40839
1 changed files with 32 additions and 0 deletions
|
@ -118,6 +118,37 @@ class Hodograph():
|
|||
|
||||
cr.restore()
|
||||
|
||||
def draw_direction_legends(self, cr: cairo.Context, x, y):
|
||||
cr.save()
|
||||
|
||||
cr.select_font_face('Sans',
|
||||
cairo.FONT_SLANT_NORMAL,
|
||||
cairo.FONT_WEIGHT_BOLD)
|
||||
|
||||
cx, cy = self.sample_to_screen(0, 0)
|
||||
|
||||
cr.set_font_size(14)
|
||||
|
||||
text = "%d°" % 180
|
||||
extents = cr.text_extents(text)
|
||||
|
||||
cr.move_to(x + cx - extents.width / 2,
|
||||
y + 4 * extents.height)
|
||||
|
||||
cr.show_text(text)
|
||||
cr.stroke()
|
||||
|
||||
text = "%d°" % 0
|
||||
extents = cr.text_extents(text)
|
||||
|
||||
cr.move_to(x + cx - extents.width / 2,
|
||||
y + self.height - 4 * extents.height)
|
||||
|
||||
cr.show_text(text)
|
||||
cr.stroke()
|
||||
|
||||
cr.restore()
|
||||
|
||||
COLORS = {
|
||||
500: (1.0, 0.4, 1.0),
|
||||
3000: (1.0, 0.4, 0.4),
|
||||
|
@ -279,6 +310,7 @@ class Hodograph():
|
|||
self.draw_sounding(cr, x, y, sounding)
|
||||
|
||||
self.draw_speed_legends(cr, x, y)
|
||||
self.draw_direction_legends(cr, x, y)
|
||||
self.draw_height_legends(cr, x, y)
|
||||
|
||||
cr.reset_clip()
|
||||
|
|
Loading…
Add table
Reference in a new issue