Coder Social home page Coder Social logo

jposada202020 / circuitpython_uplot Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 2.0 4.79 MB

Small framework to create graphics in CircuitPython

License: MIT License

Python 100.00%
bar cartesian circuitpython displayio graphical logging pie-chart plot scientific svg polar

circuitpython_uplot's Issues

ISSUE: box color needs to be custom

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.

image

Setting the max_value to larger than screen size blows up with height must be above 1.

image If I then set the max_value to something lower (100) than my screen size (240x135) then it works fine. The code for the values was from an example file. ```
#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)

`

IDEA: fill with a mesh on white and black EInk displays

My screen have a good pixel density. I really like EInk feeling for this appication.

I wish to have the graph fill option enabled, but then the blacks are to much strong. Please add a mesh fill option, so it will be like gray, with pixel on, pixel off, pixel on, pixel off and so on.

20230311_112156~2

Please add number of tickx and ticky

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.

ISSUE: first pixel is never shown

I did a test, to show a list with only 1 element and I never see it on the display. But if I increase to 2 elements, then I can see and it seems to be the 2 elements - see next image:

image

Need better scale description

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.

ubar_uplot

Setting uplot padding to 0 doesnt behave as expected

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

ubar 4th refresh index out of range

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.

ubar_overdraw

Now they are actually removing but not redrawing correctly and leaving only the first bar, still with an out of range error.

ubar_outofrange

===============================
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.

ISSUE: first pixel is never shown

I did a test, to show a list with only 1 element and I never see it on the display. But if I increase to 2 elements, then I can see and it seems to be the 2 elements - see the small 2 pixels horizontal line:

image

Please implement Thickness

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.