Skip to content

Commit c6e548c

Browse files
committed
adding uboxplot example
1 parent 76f78ae commit c6e548c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

circuitpython_uplot/uplot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class Uplot(displayio.Group):
5454
:param int height: plot box height in pixels
5555
:param int padding: padding for the plot box in all directions
5656
:param bool show_box: select if the plot box is displayed
57+
:param int background_color: background color in HEX. Defaults to black ``0x000000``
5758
5859
"""
5960

@@ -65,6 +66,7 @@ def __init__(
6566
height: int = 100,
6667
padding: int = 25,
6768
show_box: bool = True,
69+
background_color: int = 0x000000,
6870
) -> None:
6971
if width not in range(50, 481):
7072
print("Be sure to verify your values. Defaulting to width=100")
@@ -123,7 +125,7 @@ def __init__(
123125
self._drawbox()
124126

125127
self._plot_palette = displayio.Palette(14)
126-
self._plot_palette[0] = 0x000000
128+
self._plot_palette[0] = background_color
127129
self._plot_palette[1] = 0xFFFFFF
128130
self._plot_palette[2] = self._tickcolor
129131
self._plot_palette[3] = self._barcolor

docs/quick_start.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ The Uplot will be used to display our graphics. The position and the size of the
3131
could vary. This allows us to have more than 1 plot at the same time in the screen.
3232
Every one of them with different characteristics or graphs.
3333

34+
Options available are:
35+
* backround_color: Allows to change the background color. The default is black.
36+
3437
We tell the microcontroller to display our plot:
3538

3639
.. code-block:: python

0 commit comments

Comments
 (0)