Skip to content

Commit

Permalink
Merge pull request #509 from MAIKS1900/add_line_width_for_line_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
mathoudebine authored Jun 18, 2024
2 parents 6a3a217 + ea5064f commit dc62de7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/lcd/lcd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ def DisplayLineGraph(self, x: int, y: int, width: int, height: int,
max_value: int = 100,
autoscale: bool = False,
line_color: Tuple[int, int, int] = (0, 0, 0),
line_width: int = 2,
graph_axis: bool = True,
axis_color: Tuple[int, int, int] = (0, 0, 0),
background_color: Tuple[int, int, int] = (255, 255, 255),
Expand Down Expand Up @@ -417,7 +418,7 @@ def DisplayLineGraph(self, x: int, y: int, width: int, height: int,

# Draw plot graph
draw = ImageDraw.Draw(graph_image)
draw.line(list(zip(plotsX, plotsY)), fill=line_color, width=2)
draw.line(list(zip(plotsX, plotsY)), fill=line_color, width=line_width)

if graph_axis:
# Draw axis
Expand Down
1 change: 1 addition & 0 deletions library/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def display_themed_line_graph(theme_data, values):
max_value=theme_data.get("MAX_VALUE", 100),
autoscale=theme_data.get("AUTOSCALE", False),
line_color=line_color,
line_width=theme_data.get("LINE_WIDTH", 2),
graph_axis=theme_data.get("AXIS", False),
axis_color=theme_data.get("AXIS_COLOR", line_color), # If no color specified, use line color for axis
background_color=theme_data.get("BACKGROUND_COLOR", (0, 0, 0)),
Expand Down
17 changes: 17 additions & 0 deletions res/themes/theme_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: False
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -183,6 +184,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: False
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -284,6 +286,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -347,6 +350,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -411,6 +415,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: False
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -470,6 +475,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: False
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -540,6 +546,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -599,6 +606,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -658,6 +666,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -717,6 +726,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: False
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -771,6 +781,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -820,6 +831,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -911,6 +923,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -981,6 +994,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -1016,6 +1030,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -1052,6 +1067,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down Expand Up @@ -1087,6 +1103,7 @@ STATS:
HISTORY_SIZE: 10
AUTOSCALE: True
LINE_COLOR: 61, 184, 225
LINE_WIDTH: 2
AXIS: True
AXIS_COLOR: 255, 135, 0
# BACKGROUND_COLOR: 0, 0, 0
Expand Down

0 comments on commit dc62de7

Please sign in to comment.