jposada202020 / circuitpython_uplot Goto Github PK
View Code? Open in Web Editor NEWSmall framework to create graphics in CircuitPython
License: MIT License
Small framework to create graphics in CircuitPython
License: MIT License
Next image shows the following parameters:
Uplot show_box = True background_color = WHITE
plot.tick_params tickcolor = BLACK tickgrid = True
ucartesian line_color = BLACK)
As we can seem the show_box has no effect because it is draw in white color, so it is not visible. If I invert the background_color and line_color, then I can see the box.
Please add a parameter for the box color.
This is without defining the rangey value:
And here when I define the rangey:
The graph bellow for instance, I want to set the rangey to [0, 100] as it represents the humidity value. But I am setting this graph with a Y Uplot value range of 60 pixels... am I doing something wrong?? The code is here:
#truncated
data=[]
# Add dummy data to the list
data.append((55, 20, 25, 30, 35, 10))
data.append((55, 20, 25, 30, 35, 10))
data.append((55, 20, 25, 30, 35, 10))
data.append((55, 20, 25, 30, 35, 10))
my_ubar = ubar(plot, \
[d[3] for d in data], \
[d[0] for d in data], \
0xFF1000, \
True, \
projection=False, \
max_value=500, \
)
time.sleep(2)
# Changing all the bars to Yellow
my_ubar.update_colors(
[color.YELLOW, color.YELLOW, color.YELLOW, color.YELLOW]
)
time.sleep(2)
# Changing the 3 bar to Purple
my_ubar.update_bar_color(2, color.PURPLE)
# Wait 1 second
time.sleep(1)
`
I wish to be able to define the numbers of ticks. For instance, my graph x represents the time, in hours and will be the total of 24h. So maybe I will want 3 tickx, one for each 8 hours, or 6 tickx, one for each 4 hours. Similar concept for the ticky.
As the description says: Add a tickheight for x and tickheight for y, while currently tickheight apply for both axis.
In read the docs The description for scale is fairly vague. I imagine it works like label.label scale where 2 is a little bigger label?
from circuitpython_uplot.uplot import Uplot, color
from circuitpython_uplot.ubar import ubar
plot = Uplot(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, box_color=color.BLACK, scale=100)
text_group = displayio.Group()
text_group.append(plot)
text_group.append(date_label)
text_group.append(time_label)
text_group.append(pulse_label)
display.show(text_group)
a = ["a", "b", "c", "d", "e"]
b = [ListValues[0], ListValues[1], ListValues[2], ListValues[3], ListValues[4]]
ubar(plot, a, b, 0xFF1000, True)
I saw no difference between scale=2 or scale=100. Bit of head scratching as to what scale does.
I tried setting the height etc to 1 pixel less, but still same issue, it overflows the bottom right. Padding of 1px looks fine, but may have the padding overflowed past the drawable area on the right and bottom edges.
plot = Uplot(
0,
0,
DISPLAY_WIDTH-1,
DISPLAY_HEIGHT-1,
background_color=color.BLACK,
padding=0,
box_color=color.WHITE,
)
Same code as the ubar max_value test
Was happening every 3rd refresh. Updated to your latest ubar.py and uplot.py manually and now it happens every 4th refresh. As far as I can tell the bars are behaving oddly after each refresh.
3 days ago with the previous commit the bars would overlay on top of each other and not remove.
Now they are actually removing but not redrawing correctly and leaving only the first bar, still with an out of range error.
===============================
Connecting to WiFi...
Connected!
-----Token Refresh POST Attempt -------
Next Refresh Token: a09998aacf19d15589e151d582ee111fe52e085dddef1ec46d1c12a5332ba3a4
Attempting to GET FITBIT Stats!
===============================
Fitbit Date: 2023-07-17
Fitbit Time: 13:29
Today's Logged Pulses : 808
Latest 5 Minute Averages: 92,95,110,110,100
Uplot List a: a,b,c,d,e
Uplot List b: 92,95,110,110,100
Board Uptime: 55 minutes
Finished!
Next Update in: 30 seconds
===============================
-----Token Refresh POST Attempt -------
Next Refresh Token: b8962db79c118182fe4c96b7f694eb0dc6e20520d81ed6bfff107810895e6ccf
Attempting to GET FITBIT Stats!
===============================
Fitbit Date: 2023-07-17
Fitbit Time: 13:29
Today's Logged Pulses : 808
Latest 5 Minute Averages: 92,95,110,110,100
Uplot List a: a,b,c,d,e
Uplot List b: 92,95,110,110,100
Board Uptime: 56 minutes
Finished!
Next Update in: 30 seconds
===============================
-----Token Refresh POST Attempt -------
Next Refresh Token: c44a8cebe53a8a8477b413fe9689a6b1c71b59e6b5c17e3a982d6d8d6c701abf
Attempting to GET FITBIT Stats!
===============================
Fitbit Date: 2023-07-17
Fitbit Time: 13:29
Today's Logged Pulses : 808
Latest 5 Minute Averages: 92,95,110,110,100
Uplot List a: a,b,c,d,e
Uplot List b: 92,95,110,110,100
Board Uptime: 56 minutes
Finished!
Next Update in: 30 seconds
===============================
-----Token Refresh POST Attempt -------
Next Refresh Token: e8932d51e2b5c9577a85a4f475a4c1c360d62a17ffe1915e6e79b5edd4e3f2e0
Attempting to GET FITBIT Stats!
===============================
Fitbit Date: 2023-07-17
Fitbit Time: 13:29
Today's Logged Pulses : 808
Latest 5 Minute Averages: 92,95,110,110,100
Uplot List a: a,b,c,d,e
Uplot List b: 92,95,110,110,100
Index Error: index out of range
-----Token Refresh POST Attempt -------
Next Refresh Token: 3f6c8c3095816267b95258276d9510402e37c316ed10c44c452d06257b73a6cc
Attempting to GET FITBIT Stats!
===============================
Fitbit Date: 2023-07-17
Fitbit Time: 13:29
Today's Logged Pulses : 808
Latest 5 Minute Averages: 92,95,110,110,100
Uplot List a: a,b,c,d,e
Uplot List b: 92,95,110,110,100
Index Error: index out of range
plot = Uplot(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, padding=10, background_color=color.BLACK, box_color=color.BLACK)
while True:
a = ["a", "b", "c", "d", "e"]
b = [activities_latest_heart_value4, activities_latest_heart_value3, activities_latest_heart_value2, activities_latest_heart_value1, activities_latest_heart_value0]
print(f"Uplot List a: {a[0]},{a[1]},{a[2]},{a[3]},{a[4]}")
print(f"Uplot List b: {b[0]},{b[1]},{b[2]},{b[3]},{b[4]}")
try:
ubar(plot, a, b, 0xFF1000, True)
except (IndexError) as e:
print("Index Error:", e)
time.sleep(60)
continue
Printing list a & b should show some kind of anomaly for the index value but I see no change in the list. It reliably produces an index out of range error every 4th attempt.
This is part of a larger adafruit_requests Fitbit example script. Attempted to get help via adafruit discord before creating an issue.
Discord conversation with entire script.
The lines on my display are very thin. I wish to have a way to define the Cartesian line to be 2 or 3 pixels thicknes. And then have the same control for the box thickness and ticks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.