Histogram X scale cannot be set to display only 1 bar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-27 02:18 AM
Hi,
Scaling down an histogram graph to display only one bar triggers a "(min != max)" error.
I need to display from 1 to 16 bars on my histogram.
I use the setGraphRangeX(int min, int max) function for this.
However, when I get down to 1 bar with setGraphRangeX(0, 0) I get an error during execution.
This error is clear enough, but I think this limitation should not be there.
Is there anyway to get around it?
Thanks,
Franck.
Setup:
TouchGFX 4.21.1
Error reproduced using TouchGFX simulator and VS2022
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-28 04:09 AM
Hello,
I think there is also a setGraphRangeX() method with float xmin and xmax parameters.
What if you try to use setGraphRangeX(0, 0.5) or something similar ?
I understand your problem and will discuss it with my colleagues, but that could be a work-around in the meantime.
/Yoann
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-28 03:03 AM
Hello @Community member​,
setGraphRangeX(0, 0) does mean that you wanna display data between xmin = 0 and xmax = 0 :
So it means that you are basically showing nothing. If you wanna display only the first bar, I guess it should be setGraphRangeX(0, 1) instead.
For me, this limitation makes good sense, could you maybe elaborate why it doesn't look right for you and explain what we should implement instead ?
Thanks,
/Yoann
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-28 03:22 AM
Hi Yoann,
Thanks for the answer.
Yes, I would like to display xmin = 0 and xmax = 0 to get only one bar.
This would show only the first data point (data at position 0).
setGraphRangeX(0, 2) => displays 3 bars
setGraphRangeX(0, 1) => displays 2 bars
setGraphRangeX(0, 0) => triggers an error, so we cannot display only 1 data point.
The limitation should be xmin > xmax instead of xmin != xmax
Franck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-28 04:09 AM
Hello,
I think there is also a setGraphRangeX() method with float xmin and xmax parameters.
What if you try to use setGraphRangeX(0, 0.5) or something similar ?
I understand your problem and will discuss it with my colleagues, but that could be a work-around in the meantime.
/Yoann
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-28 05:13 AM
Yes, nice trick!
It does work using float parameters.
I used setGraphRangeX(0.0f, 0.0001f + Range) instead of 0.5f + Range as the 0.5f adds some margin on the right when the range is set to the maximum.
BTW, I think I found another where the bar position is not valid anymore after changing the bar width.
I am trying to wrap my head around it and will be posting a new thread.
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-30 01:25 AM
Hi,
No need to create a new post, you can just answer here and tag me to be sure I see it :)
/Yoann
ST Software Developer | TouchGFX