cancel
Showing results for 
Search instead for 
Did you mean: 

Histogram X scale cannot be set to display only 1 bar

franck23
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
Yoann KLEIN
ST Employee

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

Yoann KLEIN
ST Software Developer | TouchGFX

View solution in original post

5 REPLIES 5
Yoann KLEIN
ST Employee

Hello @Community member​,

setGraphRangeX(0, 0) does mean that you wanna display data between xmin = 0 and xmax = 0 :

0693W00000aJqgQQAS.png 

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

Yoann KLEIN
ST Software Developer | TouchGFX
franck23
Senior

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.

Yoann KLEIN
ST Employee

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

Yoann KLEIN
ST Software Developer | TouchGFX
franck23
Senior

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.

Hi,

No need to create a new post, you can just answer here and tag me to be sure I see it :)

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX