Skip to content

Commit 40bb7a2

Browse files
committed
# UPDATE: docsstrings [√]
1 parent 7506b24 commit 40bb7a2

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

adafruit_displayio_layout/widgets/cartesian.py

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ class Cartesian(Widget):
4848
:param int y: y position of the plane origin
4949
5050
:param int background_color: background color to use defaults to black (0x000000)
51-
:param int width: requested width, in pixels defaults to 100 pixels
52-
:param int height: requested height, in pixels defaults to 100 pixels
51+
:param int width: requested width, in pixels.
52+
:param int height: requested height, in pixels.
5353
54-
:param (int, int) xrange: X axes range
55-
:param (int, int) yrange: Y axes range
54+
:param (int, int) xrange: X axes range. Defaults to (0, 100)
55+
:param (int, int) yrange: Y axes range. Defaults to (0, 100)
5656
5757
:param int axes_color: axes lines color defaults to white (0xFFFFFF)
5858
:param int axes_stroke: axes lines thickness in pixels defaults to 2
5959
60-
:param int major_tick_stroke: tick lines thickness in pixels dafaults to 1
60+
:param int major_tick_stroke: tick lines thickness in pixels defaults to 1
6161
:param int major_tick_length: tick lines length in pixels defaults to 5
6262
6363
:param int tick_label_font: tick label text font
64-
:param int font_color: font color
64+
:param int font_color: font color. Defaults to white (0xFFFFFF)
6565
6666
:param int pointer_radius: pointer radius in pixels defaults to 1
67-
:param int pointer_color: pointer color defaults to white (0xFFFFFF)
67+
:param int pointer_color: pointer color. Defaults to white (0xFFFFFF)
6868
6969
7070
**Quickstart: Importing and using Cartesian**
@@ -105,6 +105,27 @@ class Cartesian(Widget):
105105
display.show(my_group) # add the group to the display
106106
107107
108+
**Summary: Cartesian Features and input variables**
109+
110+
The `cartesian` widget has some options for controlling its position, visible appearance,
111+
and scale through a collection of input variables:
112+
113+
- **position**: ``x``, ``y`` or ``anchor_point`` and ``anchored_position``
114+
115+
- **size**: ``width`` and ``height``
116+
117+
- **color**: ``axes_color``, ``font_color``, ``tick_color``, ``pointer_color``
118+
119+
- **background color**: ``background_color``
120+
121+
- **linewidths**: ``axes_stroke`` and ``major_tick_stroke``
122+
123+
- **range**: ``xrange`` and ``yrange`` This is the range in absolute units.
124+
For example, when using (20-90), the X axis will start at 20 finishing at 90.
125+
However the height of the graph is given by the height parameter. The scale
126+
is handled internal to provide a 1:1 experience when you update the graph.
127+
128+
108129
.. figure:: cartesian.gif
109130
:scale: 100 %
110131
:figwidth: 50%
@@ -134,7 +155,7 @@ class Cartesian(Widget):
134155

135156
def __init__(
136157
self,
137-
background_color=0x000000,
158+
background_color: int = 0x000000,
138159
xrange: Tuple[int, int] = (0, 100),
139160
yrange: Tuple[int, int] = (0, 100),
140161
axes_color: int = 0xFFFFFF,
@@ -465,9 +486,10 @@ def set_widget_style(self, new_style: str) -> None:
465486
try:
466487
from adafruit_styles import get_hex
467488
from adafruit_styles import styles
489+
490+
colorset = styles.THEME
491+
self._pointer_color = get_hex(colorset[new_style]["TEXT"])
492+
self._font_color = get_hex(colorset[new_style]["TEXT"])
493+
self._draw_ticks()
468494
except ImportError:
469-
pass
470-
colorset = styles.THEME
471-
self._pointer_color = get_hex(colorset[new_style]["TEXT"])
472-
self._font_color = get_hex(colorset[new_style]["TEXT"])
473-
self._draw_ticks()
495+
print("This feature is not yet implemented")

0 commit comments

Comments
 (0)