From 28a3200a47a4c22e528c280157f9d63a04a1f1a3 Mon Sep 17 00:00:00 2001
From: XANTRONIX Industrial <xan@xantronix.com>
Date: Wed, 26 Feb 2025 17:30:55 -0500
Subject: [PATCH] Slight adjustment to heights legend

---
 lib/xmet/hodograph.py | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/xmet/hodograph.py b/lib/xmet/hodograph.py
index 48e0ace..21a8409 100644
--- a/lib/xmet/hodograph.py
+++ b/lib/xmet/hodograph.py
@@ -174,7 +174,7 @@ class Hodograph():
         cr.save()
         cr.set_source_rgb(1, 1, 1)
 
-        cr.rectangle(offset + x - width / 2,
+        cr.rectangle(offset + x - width * 0.75,
                      y + width,
                      interval * 4,
                      width * 3)
@@ -182,7 +182,7 @@ class Hodograph():
         cr.fill()
 
         cr.set_source_rgb(0.8, 0.8, 0.8)
-        cr.rectangle(offset + x - width / 2,
+        cr.rectangle(offset + x - width * 0.75,
                      y + width,
                      interval * 4,
                      width * 3)
@@ -201,13 +201,11 @@ class Hodograph():
             cr.rectangle(offset + x, y + width * 1.5, width, width)
             cr.stroke()
 
-            cr.move_to(offset + x, y + 3.5*width)
-
-            if height < 1000:
-                cr.show_text("%dm" % height)
-            else:
-                cr.show_text("%dkm" % (height / 1000))
+            text    = "%dm" % (height) if height < 1000 else "%dkm" % (height /1000)
+            extents = cr.text_extents(text)
 
+            cr.move_to(offset + x - extents.width / 4, y + 3.5*width)
+            cr.show_text(text)
             cr.stroke()
 
             offset += interval