59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
| """
 | |
| 
 | |
| XY-Graphik der Abgastemperatur
 | |
| 
 | |
| """
 | |
| 
 | |
| import cairo
 | |
| import math
 | |
| from .page import Page
 | |
| 
 | |
| class Exhaust(Page):
 | |
| 
 | |
|     def draw(self, ctx):
 | |
|         # Title
 | |
|         ctx.select_font_face("Ubuntu", cairo.FontSlant.NORMAL, cairo.FontWeight.BOLD)
 | |
|         ctx.set_font_size(24)
 | |
|         ctx.move_to(10, 45)
 | |
|         ctx.show_text("Exhaust Temperature")
 | |
| 
 | |
|         # Graph anzeigen X/Y
 | |
| 
 | |
|         x0 = 55
 | |
|         y0 = 255
 | |
|         w = 300
 | |
|         h = 200
 | |
| 
 | |
|         # X-Achse
 | |
|         ctx.move_to(x0 - 20, y0)
 | |
|         ctx.line_to(x0 + w, y0)
 | |
|         # Y-Achse
 | |
|         ctx.move_to(x0, y0 + 20)
 | |
|         ctx.line_to(x0, y0 - h)
 | |
|         ctx.stroke()
 | |
|         # Pfeispitze X
 | |
|         ctx.move_to(x0-4, y0 - h + 12)
 | |
|         ctx.line_to(x0, y0 - h)
 | |
|         ctx.line_to(x0 + 4, y0 - h + 12)
 | |
|         ctx.fill()
 | |
|         # Pfeilspitze Y
 | |
|         ctx.move_to(x0 + w -12, y0 - 4)
 | |
|         ctx.line_to(x0 + w, y0)
 | |
|         ctx.line_to(x0 + w - 12, y0 + 4)
 | |
|         ctx.fill()
 | |
| 
 | |
|         # Achsenbeschriftung
 | |
|         ctx.set_font_size(16)
 | |
|         ctx.move_to(x0 - 30, y0 - h + 20)
 | |
|         ctx.show_text("°C")
 | |
|         ctx.move_to(x0 + w - 10, y0 + 15)
 | |
|         ctx.show_text("min")
 | |
| 
 | |
|         # Hier wird eine Reihe von Meßwerten erwartet
 | |
|         # Aufgrund min und max kann die Y-Achse skaliert werden
 | |
|         # Die X-Achse ist die Zeit
 | |
|         self.draw_text_center(ctx, x0 - 30, y0 - h / 2, "Temperature", True, False)
 | |
| 
 | |
|         # Einzeichnen von zwei Warnschwellen als horizontale 
 | |
|         # Linie (gestrichelt)
 |