I'm implementing a stacked bar chart, and want to show values on the chart, right above each segment of a stacked bar.
To display the values, I've called setDisplayChartValues(true) on each SimpleSeriesRenderer that I add to my XYMultipleSeriesRenderer. Problem is, the result looks like this (this is not a screenshot, but a hand-crafted mockup):
I want to display "100" in blue above the blue segment of the bar, thus representing the value of the blue segment, rather than the cumulative of red and blue.
How do I do it?
PS: I looked at the demo application's "Sales stacked bar chart", and it has the same behaviour.
The concept of the stacked bars in AChartEngine is that each bars starts from zero. This means that the blue value in your example is displaying correctly.
However, I agree that AChartEngine should one day support the stacked bar charts the way you describe them.
Related
In the chart section of the image, the value 1 is overlapping with value 19. I have used bar chart here.
Buddy its because the 1 value of above bar in stacked bar is low and you are drawing values inside bars. All you can do is try shifting values above bars but this can also overlap but give it a try. For that do the following:
chart.setDrawValueAboveBar(true);
Or you can change the color of values text as of colors of bars to differentiate for that you have to move values above bars so one can see that.
I have implemented BarChart and my Bar Chart is Grouped and Stacked.
I am done with Grouping and Stacking BarChart using MpChart Library in Android.
But I am unable to find a way of giving a different color to each bar and each stack.
Currently, I am able to set stack color. But I also want to assign a different color to each bar in a group.
I hope I explained well.
Update
Android Stacked grouped Bar Chart Kotlin Example
treat each bar as a different barSet and set color to it.
I am using achartengine to plot graph in android but there is difficulty with combining stacked bar and bar. I want this type of graph.
Is it possible to plot like that. If possible then can you give a small footprint.
Thank you.
You can get to that by building a stacked bar chart only. You don't need to combine a regular bar chart with a stacked bar chart.
There is also the new HEAP type of bar charts which is a stacked bar chart, but with every piece being appended to the previous piece of the bar rather than stacking them one above the other.
I need to remove the text on top of the bar chart i created can you tell me how to achieve it. I am enclosing the output i got with the text circled that i want to remove. I am using achartengine to draw the chart.
To disable those numbers in AChartEngine find the line that ends in:
...setDisplayChartValues(true);
And remove it. (Or switch true to false, but I think they aren't shown by default.)
This is a feature of the SimpleSeriesRenderer class, setDisplayChartValues():
Sets if the chart point values should be displayed as text.
I have 3 buttons displaying 3 different bar charts in the same application. when i click any of the button it displays bar chart with same color as shown by others. Now i want to display these 3 bar charts in 3 different colors. How is it possible? Any help will be appreciated.
Use the XYSeriesRenderer.setColor function and set it to a different colour for each Barchart.
In order to do this, you will have to have each bar added to a separate series.