there is a update_line function in the Cartesian class.
but i have not found any documentation about it -
i would expect to be able to draw some kind of linegraph with multiple points.
but looking at the code and testing that does not happen..
it seems that the first time the function is called it setups self.plot_line_point and adds the given point.
and after this it draws a line from this first point to the given point.
resulting in a star-like graph.
i tested and the only thing missing is a self.plot_line_point.append((local_x, local_y)) after the call to bitmaptools.draw_line(
my minimal testcode:
# SPDX-FileCopyrightText: 2021 Stefan Krüger
#
# SPDX-License-Identifier: MIT
#############################
"""
Simple Test for line-ploting with the Cartesian widget.
"""
import time
import board
import displayio
from adafruit_displayio_layout.widgets.cartesian import Cartesian
# create the display on the PyPortal or Clue or PyBadge (for example)
display = board.DISPLAY
# pybadge display: 160x128
# Create a Cartesian widget
# https://circuitpython.readthedocs.io/projects/displayio-layout/en/latest/api.html#module-adafruit_displayio_layout.widgets.cartesian
my_plane = Cartesian(
x=30, # x position for the plane
y=2, # y plane position
width=128, # display width
height=105, # display height
xrange=(0, 90),
yrange=(0, 90),
)
my_group = displayio.Group()
my_group.append(my_plane)
display.show(my_group) # add high level Group to the display
positions = [
(0, 0),
(10, 10),
(20, 50),
(30, 60),
(40, 40),
(50, 80),
(60, 20),
(70, 60),
(80, 30),
(90, 90),
]
print("displayIO__layout_widget_cartesian_lineplot.py")
for x, y in positions:
my_plane.update_line(x, y)
time.sleep(1)
while True:
pass
@FoamyGuy @kattni should i submit a pull request for this?
there is a
update_line
function in theCartesian
class. but i have not found any documentation about it -i would expect to be able to draw some kind of linegraph with multiple points. but looking at the code and testing that does not happen..
it seems that the first time the function is called it setups
self.plot_line_point
and adds the given point. and after this it draws a line from this first point to the given point. resulting in a star-like graph.i tested and the only thing missing is a
self.plot_line_point.append((local_x, local_y))
after the call tobitmaptools.draw_line(
my minimal testcode:
@FoamyGuy @kattni should i submit a pull request for this?