MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

Value text overlap on StackedBarChart

Open petrusgomes opened this issue 11 years ago • 5 comments

Hello,

I'm trying to build a stacked horizontal bar chart, following the StackedBarActivity example, but the values texts are showing like this (first chart is buggy, should show 288 & 12 separated):

device-2015-07-15-160016

The problem seems to be the large scale from 288 to 12. Any ideas of how to fix this?

I'm using:

chart.setDrawValueAboveBar(false);

ArrayList yVals = new ArrayList(); yVals.add(new BarEntry(new float[] {12, 288}, 0));

Thanks

petrusgomes avatar Jul 15 '15 19:07 petrusgomes

Hmmm yea there is not much I can do about this, you will have to modify the library and apply some kind of fix I suppose

PhilJay avatar Jul 16 '15 18:07 PhilJay

@petrusgomes Can you share some code about how you implemented the horizontal stacked bar chart? I'm stuck here pls.

Im-PJ avatar Aug 20 '15 18:08 Im-PJ

@Im-PJ I followed the StackedBarActivity example

https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivity.java

But used HorizontalBarChart instead of BarChart. As I remember, you might have to change the data arrays to match the Y and X changes. I ended not using this library in our app, so I don't have the code to put here. Sorry

petrusgomes avatar Aug 26 '15 01:08 petrusgomes

@petrusgomes Thanks I got it working.. May I ask why? Is there any better alternative or you wrote everything from scratch.

Im-PJ avatar Aug 26 '15 02:08 Im-PJ

@Im-PJ Mainly because of the issue I opened here. I only needed some horizontal bars, so I ended up using ProgressBars from Android, with some tweaks. Other than that, this was the better android chart lib I found on my quick search

petrusgomes avatar Aug 26 '15 15:08 petrusgomes