Skip to content

Commit dc62de7

Browse files
authored
Merge pull request #509 from MAIKS1900/add_line_width_for_line_graph
2 parents 6a3a217 + ea5064f commit dc62de7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

library/lcd/lcd_comm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ def DisplayLineGraph(self, x: int, y: int, width: int, height: int,
347347
max_value: int = 100,
348348
autoscale: bool = False,
349349
line_color: Tuple[int, int, int] = (0, 0, 0),
350+
line_width: int = 2,
350351
graph_axis: bool = True,
351352
axis_color: Tuple[int, int, int] = (0, 0, 0),
352353
background_color: Tuple[int, int, int] = (255, 255, 255),
@@ -417,7 +418,7 @@ def DisplayLineGraph(self, x: int, y: int, width: int, height: int,
417418

418419
# Draw plot graph
419420
draw = ImageDraw.Draw(graph_image)
420-
draw.line(list(zip(plotsX, plotsY)), fill=line_color, width=2)
421+
draw.line(list(zip(plotsX, plotsY)), fill=line_color, width=line_width)
421422

422423
if graph_axis:
423424
# Draw axis

library/stats.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def display_themed_line_graph(theme_data, values):
219219
max_value=theme_data.get("MAX_VALUE", 100),
220220
autoscale=theme_data.get("AUTOSCALE", False),
221221
line_color=line_color,
222+
line_width=theme_data.get("LINE_WIDTH", 2),
222223
graph_axis=theme_data.get("AXIS", False),
223224
axis_color=theme_data.get("AXIS_COLOR", line_color), # If no color specified, use line color for axis
224225
background_color=theme_data.get("BACKGROUND_COLOR", (0, 0, 0)),

res/themes/theme_example.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ STATS:
120120
HISTORY_SIZE: 10
121121
AUTOSCALE: False
122122
LINE_COLOR: 61, 184, 225
123+
LINE_WIDTH: 2
123124
AXIS: True
124125
AXIS_COLOR: 255, 135, 0
125126
# BACKGROUND_COLOR: 0, 0, 0
@@ -183,6 +184,7 @@ STATS:
183184
HISTORY_SIZE: 10
184185
AUTOSCALE: False
185186
LINE_COLOR: 61, 184, 225
187+
LINE_WIDTH: 2
186188
AXIS: True
187189
AXIS_COLOR: 255, 135, 0
188190
# BACKGROUND_COLOR: 0, 0, 0
@@ -284,6 +286,7 @@ STATS:
284286
HISTORY_SIZE: 10
285287
AUTOSCALE: True
286288
LINE_COLOR: 61, 184, 225
289+
LINE_WIDTH: 2
287290
AXIS: True
288291
AXIS_COLOR: 255, 135, 0
289292
# BACKGROUND_COLOR: 0, 0, 0
@@ -347,6 +350,7 @@ STATS:
347350
HISTORY_SIZE: 10
348351
AUTOSCALE: True
349352
LINE_COLOR: 61, 184, 225
353+
LINE_WIDTH: 2
350354
AXIS: True
351355
AXIS_COLOR: 255, 135, 0
352356
# BACKGROUND_COLOR: 0, 0, 0
@@ -411,6 +415,7 @@ STATS:
411415
HISTORY_SIZE: 10
412416
AUTOSCALE: False
413417
LINE_COLOR: 61, 184, 225
418+
LINE_WIDTH: 2
414419
AXIS: True
415420
AXIS_COLOR: 255, 135, 0
416421
# BACKGROUND_COLOR: 0, 0, 0
@@ -470,6 +475,7 @@ STATS:
470475
HISTORY_SIZE: 10
471476
AUTOSCALE: False
472477
LINE_COLOR: 61, 184, 225
478+
LINE_WIDTH: 2
473479
AXIS: True
474480
AXIS_COLOR: 255, 135, 0
475481
# BACKGROUND_COLOR: 0, 0, 0
@@ -540,6 +546,7 @@ STATS:
540546
HISTORY_SIZE: 10
541547
AUTOSCALE: True
542548
LINE_COLOR: 61, 184, 225
549+
LINE_WIDTH: 2
543550
AXIS: True
544551
AXIS_COLOR: 255, 135, 0
545552
# BACKGROUND_COLOR: 0, 0, 0
@@ -599,6 +606,7 @@ STATS:
599606
HISTORY_SIZE: 10
600607
AUTOSCALE: True
601608
LINE_COLOR: 61, 184, 225
609+
LINE_WIDTH: 2
602610
AXIS: True
603611
AXIS_COLOR: 255, 135, 0
604612
# BACKGROUND_COLOR: 0, 0, 0
@@ -658,6 +666,7 @@ STATS:
658666
HISTORY_SIZE: 10
659667
AUTOSCALE: True
660668
LINE_COLOR: 61, 184, 225
669+
LINE_WIDTH: 2
661670
AXIS: True
662671
AXIS_COLOR: 255, 135, 0
663672
# BACKGROUND_COLOR: 0, 0, 0
@@ -717,6 +726,7 @@ STATS:
717726
HISTORY_SIZE: 10
718727
AUTOSCALE: False
719728
LINE_COLOR: 61, 184, 225
729+
LINE_WIDTH: 2
720730
AXIS: True
721731
AXIS_COLOR: 255, 135, 0
722732
# BACKGROUND_COLOR: 0, 0, 0
@@ -771,6 +781,7 @@ STATS:
771781
HISTORY_SIZE: 10
772782
AUTOSCALE: True
773783
LINE_COLOR: 61, 184, 225
784+
LINE_WIDTH: 2
774785
AXIS: True
775786
AXIS_COLOR: 255, 135, 0
776787
# BACKGROUND_COLOR: 0, 0, 0
@@ -820,6 +831,7 @@ STATS:
820831
HISTORY_SIZE: 10
821832
AUTOSCALE: True
822833
LINE_COLOR: 61, 184, 225
834+
LINE_WIDTH: 2
823835
AXIS: True
824836
AXIS_COLOR: 255, 135, 0
825837
# BACKGROUND_COLOR: 0, 0, 0
@@ -911,6 +923,7 @@ STATS:
911923
HISTORY_SIZE: 10
912924
AUTOSCALE: True
913925
LINE_COLOR: 61, 184, 225
926+
LINE_WIDTH: 2
914927
AXIS: True
915928
AXIS_COLOR: 255, 135, 0
916929
# BACKGROUND_COLOR: 0, 0, 0
@@ -981,6 +994,7 @@ STATS:
981994
HISTORY_SIZE: 10
982995
AUTOSCALE: True
983996
LINE_COLOR: 61, 184, 225
997+
LINE_WIDTH: 2
984998
AXIS: True
985999
AXIS_COLOR: 255, 135, 0
9861000
# BACKGROUND_COLOR: 0, 0, 0
@@ -1016,6 +1030,7 @@ STATS:
10161030
HISTORY_SIZE: 10
10171031
AUTOSCALE: True
10181032
LINE_COLOR: 61, 184, 225
1033+
LINE_WIDTH: 2
10191034
AXIS: True
10201035
AXIS_COLOR: 255, 135, 0
10211036
# BACKGROUND_COLOR: 0, 0, 0
@@ -1052,6 +1067,7 @@ STATS:
10521067
HISTORY_SIZE: 10
10531068
AUTOSCALE: True
10541069
LINE_COLOR: 61, 184, 225
1070+
LINE_WIDTH: 2
10551071
AXIS: True
10561072
AXIS_COLOR: 255, 135, 0
10571073
# BACKGROUND_COLOR: 0, 0, 0
@@ -1087,6 +1103,7 @@ STATS:
10871103
HISTORY_SIZE: 10
10881104
AUTOSCALE: True
10891105
LINE_COLOR: 61, 184, 225
1106+
LINE_WIDTH: 2
10901107
AXIS: True
10911108
AXIS_COLOR: 255, 135, 0
10921109
# BACKGROUND_COLOR: 0, 0, 0

0 commit comments

Comments
 (0)