Skip to content

Commit 525a48a

Browse files
authored
Merge pull request #6 from kmatch98/auto_update
Updated examples for pylint
2 parents 48123a0 + 3367ba5 commit 525a48a

3 files changed

+62
-40
lines changed

examples/display_shapes_sparkline_simpletest.py

+21-13
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
# See the bottom for a code example using the `sparkline` Class.
55

66
# # File: display_shapes_sparkline.py
7-
# A sparkline is a scrolling line graph, where any values added to sparkline using `add_value` are plotted.
7+
# A sparkline is a scrolling line graph, where any values added to sparkline using
8+
# `add_value` are plotted.
89
#
9-
# The `sparkline` class creates an element suitable for adding to the display using `display.show(mySparkline)`
10+
# The `sparkline` class creates an element suitable for adding to the display using
11+
# `display.show(mySparkline)`
1012
# or adding to a `displayio.Group` to be displayed.
1113
#
12-
# When creating the sparkline, identify the number of `max_items` that will be included in the graph.
13-
# When additional elements are added to the sparkline and the number of items has exceeded max_items,
14-
# any excess values are removed from the left of the graph, and new values are added to the right.
14+
# When creating the sparkline, identify the number of `max_items` that will be
15+
# included in the graph.
16+
# When additional elements are added to the sparkline and the number of items has
17+
# exceeded max_items, any excess values are removed from the left of the graph,
18+
# and new values are added to the right.
1519

1620

1721
# The following is an example that shows the
@@ -23,11 +27,12 @@
2327
# add new values to sparkline `add_value`
2428
# update the sparklines `update`
2529

30+
import time
31+
import random
2632
import board
2733
import displayio
28-
import terminalio
29-
import random
30-
import time
34+
35+
3136
from adafruit_display_shapes.sparkline import Sparkline
3237

3338
if "DISPLAY" not in dir(board):
@@ -47,7 +52,7 @@
4752

4853
while not spi.try_lock():
4954
spi.configure(baudrate=32000000)
50-
pass
55+
5156
spi.unlock()
5257

5358
display_bus = displayio.FourWire(
@@ -90,15 +95,18 @@
9095
chartWidth = display.width
9196
chartHeight = display.height
9297

93-
# mySparkline1 uses a vertical y range between 0 to 10 and will contain a maximum of 40 items
98+
# mySparkline1 uses a vertical y range between 0 to 10 and will contain a
99+
# maximum of 40 items
94100
mySparkline1 = Sparkline(
95101
width=chartWidth, height=chartHeight, max_items=40, yMin=0, yMax=10, x=0, y=0
96102
)
97103

98-
# Create a group to hold the sparkline and append the sparkline into the group (myGroup)
104+
# Create a group to hold the sparkline and append the sparkline into the
105+
# group (myGroup)
99106
#
100-
# Note: In cases where display elements will overlap, then the order the elements are added to the
101-
# group will set which is on top. Latter elements are displayed on top of former elemtns.
107+
# Note: In cases where display elements will overlap, then the order the elements
108+
# are added to the group will set which is on top. Latter elements are displayed
109+
# on top of former elemtns.
102110
myGroup = displayio.Group(max_size=1)
103111

104112
# add the sparkline into myGroup

examples/display_shapes_sparkline_ticks.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
# See the bottom for a code example using the `sparkline` Class.
55

66
# # File: display_shapes_sparkline.py
7-
# A sparkline is a scrolling line graph, where any values added to sparkline using `add_value` are plotted.
7+
# A sparkline is a scrolling line graph, where any values added to sparkline
8+
# using `add_value` are plotted.
89
#
9-
# The `sparkline` class creates an element suitable for adding to the display using `display.show(mySparkline)`
10-
# or adding to a `displayio.Group` to be displayed.
10+
# The `sparkline` class creates an element suitable for adding to the display
11+
# using `display.show(mySparkline)` or adding to a `displayio.Group` to be displayed.
1112
#
12-
# When creating the sparkline, identify the number of `max_items` that will be included in the graph.
13-
# When additional elements are added to the sparkline and the number of items has exceeded max_items,
14-
# any excess values are removed from the left of the graph, and new values are added to the right.
13+
# When creating the sparkline, identify the number of `max_items` that will be
14+
# included in the graph.
15+
# When additional elements are added to the sparkline and the number of items
16+
# has exceeded max_items, any excess values are removed from the left of the
17+
# graph, and new values are added to the right.
1518

1619

1720
# The following is an example that shows the
@@ -100,7 +103,8 @@
100103

101104
# Setup the first bitmap and sparkline
102105
# This sparkline has no background bitmap
103-
# mySparkline1 uses a vertical y range between 0 to 10 and will contain a maximum of 40 items
106+
# mySparkline1 uses a vertical y range between 0 to 10 and will contain a
107+
# maximum of 40 items
104108
mySparkline1 = Sparkline(
105109
width=chartWidth,
106110
height=chartHeight,
@@ -142,8 +146,9 @@
142146
# Create a group to hold the sparkline, text, rectangle and tickmarks
143147
# append them into the group (myGroup)
144148
#
145-
# Note: In cases where display elements will overlap, then the order the elements are added to the
146-
# group will set which is on top. Latter elements are displayed on top of former elemtns.
149+
# Note: In cases where display elements will overlap, then the order the
150+
# elements are added to the group will set which is on top. Latter elements
151+
# are displayed on top of former elemtns.
147152

148153
myGroup = displayio.Group(max_size=20)
149154

examples/display_shapes_sparkline_triple.py

+27-18
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
# See the bottom for a code example using the `sparkline` Class.
55

66
# # File: display_shapes_sparkline.py
7-
# A sparkline is a scrolling line graph, where any values added to sparkline using `add_value` are plotted.
7+
# A sparkline is a scrolling line graph, where any values added to sparkline
8+
# using `add_value` are plotted.
89
#
9-
# The `sparkline` class creates an element suitable for adding to the display using `display.show(mySparkline)`
10-
# or adding to a `displayio.Group` to be displayed.
10+
# The `sparkline` class creates an element suitable for adding to the display
11+
# using `display.show(mySparkline)` or adding to a `displayio.Group` to be displayed.
1112
#
12-
# When creating the sparkline, identify the number of `max_items` that will be included in the graph.
13-
# When additional elements are added to the sparkline and the number of items has exceeded max_items,
14-
# any excess values are removed from the left of the graph, and new values are added to the right.
13+
# When creating the sparkline, identify the number of `max_items` that will be
14+
# included in the graph.
15+
# When additional elements are added to the sparkline and the number of items
16+
# has exceeded max_items, any excess values are removed from the left of the
17+
# graph, and new values are added to the right.
1518

1619

1720
# The following is an example that shows the
@@ -23,11 +26,11 @@
2326
# add new values to sparkline `add_value`
2427
# update the sparklines `update`
2528

29+
import random
30+
import time
2631
import board
2732
import displayio
2833
import terminalio
29-
import random
30-
import time
3134
from adafruit_display_shapes.sparkline import Sparkline
3235
from adafruit_ili9341 import ILI9341
3336
from adafruit_display_text import label
@@ -75,7 +78,7 @@
7578
display_bus,
7679
width=DISPLAY_WIDTH,
7780
height=DISPLAY_HEIGHT,
78-
rotation=180, # The rotation can be adjusted to match your configuration.
81+
rotation=180, # The rotation can be adjusted to match your configuration.
7982
auto_refresh=True,
8083
native_frames_per_second=90,
8184
)
@@ -124,7 +127,8 @@
124127

125128

126129
# Setup the second bitmap and sparkline
127-
# mySparkline2 uses a vertical y range between 0 to 1, and will contain a maximum of 10 items
130+
# mySparkline2 uses a vertical y range between 0 to 1, and will contain a
131+
# maximum of 10 items
128132
#
129133
palette2 = displayio.Palette(1) # color palette used for bitmap2 (one color)
130134
palette2[0] = 0x0000FF
@@ -147,9 +151,12 @@
147151

148152
# Setup the third bitmap and third sparkline
149153
# mySparkline3 contains a maximum of 10 items
150-
# since yMin and yMax are not specified, mySparkline3 uses autoranging for both the top and bottom of the y-axis.
151-
# Note1: Any unspecified edge limit (yMin or yMax) will autorange that edge based on the data in the list.
152-
# Note2: You can read back the value of the y-axis limits by using mySparkline3.yBottom or mySparkline3.yTop
154+
# since yMin and yMax are not specified, mySparkline3 uses autoranging for both
155+
# the top and bottom of the y-axis.
156+
# Note1: Any unspecified edge limit (yMin or yMax) will autorange that edge based
157+
# on the data in the list.
158+
# Note2: You can read back the value of the y-axis limits by using
159+
# mySparkline3.yBottom or mySparkline3.yTop
153160

154161

155162
palette3 = displayio.Palette(1) # color palette used for bitmap (one color)
@@ -187,12 +194,12 @@
187194
120 + mySparkline3.height,
188195
) # set the text anchored position to the upper right of the graph
189196

190-
191197
# Create a group to hold the three bitmap TileGrids and the three sparklines and
192198
# append them into the group (myGroup)
193199
#
194-
# Note: In cases where display elements will overlap, then the order the elements are added to the
195-
# group will set which is on top. Latter elements are displayed on top of former elemtns.
200+
# Note: In cases where display elements will overlap, then the order the elements
201+
# are added to the group will set which is on top. Latter elements are displayed
202+
# on top of former elemtns.
196203
myGroup = displayio.Group(max_size=20)
197204

198205
myGroup.append(mySparkline1)
@@ -207,7 +214,8 @@
207214
myGroup.append(textLabel3a)
208215
myGroup.append(textLabel3b)
209216

210-
# Set the display to show myGroup that contains all the bitmap TileGrids and sparklines
217+
# Set the display to show myGroup that contains all the bitmap TileGrids and
218+
# sparklines
211219
display.show(myGroup)
212220

213221
i = 0 # This is a counter for changing the random values for mySparkline3
@@ -227,7 +235,8 @@
227235
# Note: For mySparkline2, the y-axis range is set from 0 to 1.
228236
# With the random values set between -1 and +2, the values will sometimes
229237
# be out of the y-range. This example shows how the fixed y-range (0 to 1)
230-
# will "clip" values (it will not display them) that are above or below the y-range.
238+
# will "clip" values (it will not display them) that are above or below the
239+
# y-range.
231240
mySparkline2.add_value(random.uniform(-1, 2))
232241

233242
# mySparkline3 is set autoranging for the top and bottom of the Y-axis

0 commit comments

Comments
 (0)