Android Question [B4X] [xChart] Hide 0 values in Bar Chart

Alexander Stolte

Expert
Licensed User
Longtime User

Is there a way to hide values that are 0?
The color does not quite match my background color, since I don't want to display 0 now, it would be nice if you could hide them

(88) mage.png


Thanks
 

klaus

Expert
Licensed User
Longtime User
Can you post a small project showing the problem.
Normally the zeros should be displayed in white. The program looks for the contrast color.
In your case, the reader does even not know that there are 4 bars and not three.

This is what i get, tested with B4J and B4A.

1738594129019.png
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I guess this is what OP want, don't display value as Y is 0.

nozero.png
 
Upvote 0

teddybear

Well-Known Member
Licensed User
But before adding it i need to understand the color problem, the zeros should be white.
The zeros should be white, it is the contrast color of the ChartBackgroundColor. I think the color black 0 is modified by OP
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I set the ChartBackgroundColor to transparent so that I have one less property (I use several charts) to worry about when switching from dark to light mode, which is probably why it can't determine the correct color
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The transparent color is the problem.
I will not add a HideZeroValues property because it will not solve the real problem. Zero values are a special case. What about values near zero ?
When the text length of a bar value is longer than the bar height, the text is displayed above or below the bar and in these cases the problem remains.


1738655226957.png
1738655072016.png
 
Last edited:
Upvote 0
Top