Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar doesn't display anything if value is under 1.0 and radius not effecting bar #590

Open
zagi988 opened this issue Dec 7, 2023 · 11 comments
Labels
documentation Improvements or additions to documentation

Comments

@zagi988
Copy link

zagi988 commented Dec 7, 2023

Describe the bug

If I make a "bar" object and set it min:0, max:5 and have a value of 0.00<>0.99, nothing is displayed. 1.0> already jumps to the right part of the bar. Also, when "radius" is applied to "bar", only it's background gets the corners, value bar stays with pill shape.

To Reproduce

{"page":1,"id":72,"obj":"bar","x":15,"y":430,"w":185,"h":30,"min":0,"max":5,"radius":5}

Expected behavior

Bar to display the proper value even for values under 1.0 and value bar to adopt the shape of background.

Screenshots or video

image

@zagi988 zagi988 added the bug Something isn't working label Dec 7, 2023
@zagi988
Copy link
Author

zagi988 commented Dec 9, 2023

Ok, just figured that I need to set "radius10" for radius. At least that isn't a bug.

@fvanroie
Copy link
Collaborator

fvanroie commented Dec 9, 2023

min, max, val and start_value are all int16 so you can't use floating point numbers.

@zagi988
Copy link
Author

zagi988 commented Dec 9, 2023

I don't understand. How can I use floating point number for amperage and can't use it for power?
What is the difference?

@fvanroie
Copy link
Collaborator

fvanroie commented Dec 9, 2023

You shouldn't use floating point in any case, the result is undefined. Use Round to make the number an integer so it is interpreted correctly.

If you want more then 5 steps for the Amperage, you can multiply by a fixed number (e.g. 10 or 20) frist before rounding the result. Also adjust the max in that case by the same factor.

@fvanroie fvanroie added documentation Improvements or additions to documentation and removed bug Something isn't working labels Dec 9, 2023
@zagi988
Copy link
Author

zagi988 commented Dec 9, 2023

So wait, if I got it right, what you are telling me is that I shouldn't have any .something values?
Like, I can't have any bar display something that is let's say 23.4, I must round it to 23?

@fvanroie
Copy link
Collaborator

fvanroie commented Dec 9, 2023

23.4 is not an integer, 23 is... LVGL only support integer values.
If you want to show 23.4, then multiply by 10 before rounding to get 234. But you must multiply your max value also by 10.

@zagi988
Copy link
Author

zagi988 commented Dec 9, 2023

aaaaa, I understand now. Thanks!

@zagi988 zagi988 closed this as completed Dec 9, 2023
@fvanroie
Copy link
Collaborator

fvanroie commented Dec 9, 2023

No problem, you're welcome.

@zagi988
Copy link
Author

zagi988 commented May 18, 2024

We still have the problem of radius not affecting the bar in bar. Only bar background gets changed.

@zagi988 zagi988 reopened this May 18, 2024
@fvanroie
Copy link
Collaborator

Show your jsonl and screenshot please. Did you use radius10 as indicated above?

@fvanroie
Copy link
Collaborator

Is this still an issue? Please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants