Skip to content

Function that clears the _spark_list list #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 25, 2021
Merged
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
9 changes: 9 additions & 0 deletions adafruit_display_shapes/sparkline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

"""

# pylint: disable=too-many-instance-attributes

import displayio
from adafruit_display_shapes.line import Line

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

def clear_values(self):
"""Removes all values from the _spark_list list and removes all lines in the group"""

for _ in range(len(self)): # remove all items from the current group
self.pop()
self._spark_list = [] # empty the list

def add_value(self, value):
"""Add a value to the sparkline.
:param value: The value to be added to the sparkline
Expand Down