I have problem with displaying of bars value. I want to display multiply bar chart, but when values are similar, then text is not very good readable :(.
See picture here.
Do you have some ideas for improving this?
Thanks
I would suggest that you either develop some kind of mechanism that disables the drawing of values if they are too close to each other.
Other than that, you could:
disable drawing the values in general
reduce the text size drastically
reduce the number of decimals
use the ValueFormatter interface and disallow drawint 0 values
Related
I am creating a line chart using MPAndroidChart, all is working great, but I've noticed that at the labels often become bunched up. I know there is a way to prevent this (I've seen other apps that don't have this issue,) but I don't know what setting to enable.
There are a couple of ways you could make the labels fit better.
Decrease the text size of the X axis labels with mChart.getXAxis().setTextSize(float)
Set a label count limit for the X axis using mChart.getXAxis().setLabelCount(int). This should work fine, as you are already not showing one label per data point.
Change the date format of your label.
Some, all or none of these might help you, depending on your requirements. Good luck!
I'm using achartengine lib and I have problem with displaying of bars value. I want to display multiply bar chart, but when the values are similar, the text is not good for readability.
Does any one provide some ideas for improving this? Or exists another library for bar chart, where it is possible to do this?
Use this library MPAndroidChart
It supports multiple type of charts and also dragging, zooming etc.
I've worked large time with AChartEngine and now I know to plot a special bar diagram. Most of the bars are small. But two of them are much bigger than the others. If I use the function "setXAxisMax", the small bars are ridiculous small in the chart.
My question is, is there any way to plot the axis and some of the bars in two parts using ACharEngine? Or is it only possible to plot continuous bars?
Thanks in advance.
I have also had the chance of using a few graphing engines and i haven't
come across any that allows one to draw a single bar as two parts.In any case it will be very misleading when reading the values of the graphs.One solution which i use frequently would be to set a min value for the axis(y-axis) so that the values don't start from zero.that way you reduce the range significantly.
I'm using the Androidplot library to plot a Barchart to display something.
The range of my values are -40 till +40.
How can I plot a bar to the negative side? I just want to center the zero on the y-axis in the middle and the bars should growing up or down, if the value is positiv of negativ. My bars are growing from the lower bound upwards. It should look like this:
That works for me:
plot.centerOnRangeOrigin(0);
plot.setRangeLowerBoundary(0,BoundaryMode.AUTO);
Where plot is a instance of XYPlot.
Negative bar support has recently been added to Androidplot 0.6.2; you'll need to use the latest development version to get it (it's very stable).
Once you have the correct version of Androidplot you can use Maria Reina's suggestion to enable the display of negative values. Here's how I'm doing it in the screenshot below:
plot.setUserRangeOrigin(0);
plot.setRangeBoundaries(0, BoundaryMode.AUTO, 0,BoundaryMode.AUTO);
Note : There is currently a bug where if you are using overlay mode with 2 or more series and have negative bars, the overlay order of negative bars is reversed, causing the smaller negative values in a bargroup to be obscured by the larger ones. If your goal is simply to reproduce the image above though then you should be fine.
That's a great question. I think there's no way to do that with the current version of AndroidPlot (0.6.0) with a single series of values.
I created a workaround in my project. I know it's not perfect, but it works: create two series that overlap, one in green and one in the background color. Suppose you have your currentValue to draw..
if (currentValue>=0) {
greenRes[i] = Float.valueOf(currentValue);
coverRes[i] = Float.valueOf(0);
}
else {
greenRes[i] = Float.valueOf(0);
coverRes[i] = Float.valueOf(currentValue);
}
In this way you always have the green bar starting from the zero axis and going up or down.
When drawing the bar chart I end up with the last bar being squeezed out of frame, regardless of whether the orientation of the x-axis is vertical or horizontal. I have disabled panning so maybe this has something to do with it but enabling it is not an option.
It looks like this:
I've tried changing the margins/bar width and adding a dummy empty value to the end of the dataset, but the problem persists. Is there a setting somewhere to fix this?
EDIT - I found I can actually add a dummy empty entry at the end of the series and this fixes the problem (long story short I forgot I was limiting the length of the x-axis), but this is a rather ugly solution so if anybody knows of a better one please don't hesitate to inform us!
Thanks in advance!
Half of the bar is outside of the viewable part of the chart.
Set setXAxisMax to your series .getMaxX +1 or 0.5 or equivalent for the YAxis usually fixes this kind of problems.
If you add a dummy value you might get a tiny line at the bottom of the graph.