Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions library/lcd/lcd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ def DisplayLineGraph(self, x: int, y: int, width: int, height: int,
axis_font: str = "./res/fonts/roboto/Roboto-Black.ttf",
axis_font_size: int = 10,
background_color: Color = (255, 255, 255),
background_image: Optional[str] = None):
background_image: Optional[str] = None,
axis_minmax_format: str = "{:0.0f}"):
# Generate a plot graph and display it
# Provide the background image path to display plot graph with transparent background

Expand Down Expand Up @@ -451,13 +452,13 @@ def DisplayLineGraph(self, x: int, y: int, width: int, height: int,

# Draw Legend
draw.line([0, 0, 1, 0], fill=axis_color)
text = f"{int(max_value)}"
text = axis_minmax_format.format(max_value)
ttfont = self.open_font(axis_font, axis_font_size)
_, top, right, bottom = ttfont.getbbox(text)
draw.text((2, 0 - top), text,
font=ttfont, fill=axis_color)

text = f"{int(min_value)}"
text = axis_minmax_format.format(min_value)
_, top, right, bottom = ttfont.getbbox(text)
draw.text((width - 1 - right, height - 2 - bottom), text,
font=ttfont, fill=axis_color)
Expand Down
Loading