Skip to content

Commit 5d8bffe

Browse files
authored
Merge pull request #32 from Lukas1337/master
Function that clears the _spark_list list
2 parents 90d8dfc + b6c83c3 commit 5d8bffe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

adafruit_display_shapes/sparkline.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
3838
"""
3939

40+
# pylint: disable=too-many-instance-attributes
41+
4042
import displayio
4143
from adafruit_display_shapes.line import Line
4244

@@ -88,6 +90,13 @@ def __init__(
8890
max_size=self._max_items - 1, x=x, y=y
8991
) # self is a group of lines
9092

93+
def clear_values(self):
94+
"""Removes all values from the _spark_list list and removes all lines in the group"""
95+
96+
for _ in range(len(self)): # remove all items from the current group
97+
self.pop()
98+
self._spark_list = [] # empty the list
99+
91100
def add_value(self, value):
92101
"""Add a value to the sparkline.
93102
:param value: The value to be added to the sparkline

0 commit comments

Comments
 (0)