Implement SkewTGraph.sample_to_screen()

Implement SkewTGraph.sample_to_screen() to convert a sample value to
X/Y coordinates
This commit is contained in:
XANTRONIX 2025-02-24 09:47:02 -05:00
parent 1edb4f8c2f
commit d7831ab71a

View file

@ -67,12 +67,15 @@ class SkewTGraph():
return self.skew_t_to_graph(x, y)
def sample_to_screen(self, temp: float, pressure: float):
return self.graph_to_screen(*self.sample_to_graph(temp, pressure))
def draw_isotherms(self, cr: cairo.Context, x: float, y: float):
cr.set_source_rgb(0.95, 0.95, 0.95)
for temp in range(-150, TEMP_MAX+1, TEMP_STEP):
x1, y1 = self.graph_to_screen(*self.sample_to_graph(temp, PRESSURE_MAX))
x2, y2 = self.graph_to_screen(*self.sample_to_graph(temp, PRESSURE_MIN))
x1, y1 = self.sample_to_screen(temp, PRESSURE_MAX)
x2, y2 = self.sample_to_screen(temp, PRESSURE_MIN)
cr.move_to(x + x1, y + y1)
cr.line_to(x + x2, y + y2)