I recently started using achartengine 1.2.0 for new type of chart, the HEAP one. It works great in general but I've found a one issue with the way the chart handles zero values in series. I do have a chart with 7 bars (each bar is one day of week) and multiple series. I noticed that values in series which are equall to zero are still rendered on chart as a tiny line. Here's the screenshot:
How I can get rid of those lines?
You can try adding MathHelper.NULL_VALUE insted of the zero values.
Related
I am drawing a Pie chart in Android using MPAndroidChart. I have two different array list for different teams and need to show both list in combined form on Pie chart. Now i'm having an issue while drawing data on chart.
As you can see in screenshot "caught" type is showing 2 time with different values in chart. How to combine both of them with sum of their respective values?
I need to show chart with dashed line in my application. I am using MpAndroidChart to achieve it. It works, but when data contains too much values, it works incorrectly. For example:
Only 7 values on chart:
Over 500 values:
How to fix it?
The library behaves as expected. The problem is that you are providing too many data points so that the curve overlaps itself (and thus the dashing is displayed as in your image).
Depending on your use case I can suggest the following solutions:
Reduce the line width (probably not sufficient in your case)
Smooth the data points (on this page an overview of possible methods is given)
I'm using AChartEngine library for Android to create a time chart.
I wonder if is there any way I can limit the zoom so that the X labels do not appear duplicated as in the image?
There are some ways to fix this. For instance, you can change the date format of the time chart you are displaying.
Hi I am using A chart Engine to display pie chart in android.In my code I want to show values on labels and area corresponding to that vale on legend.But I am unable to get that one.Please can any one helps to me.Thanks in advance.
I want like below
Displaying the pie labels with separate values from the legend labels is not possible in AChartEngine.
However, you can display the pie slice value (age in your case) in the middle of each slice, using:
renderer.setDisplayChartValues(true);
There was a bug in the code that was preventing displaying the chart values when the labels were not displaying. I have just fixed this issue in SVN. You can checkout the code according to this page and run an ant dist in order to build an up to date achartengine.jar file including this fix.
I was also having the same problem but now its solved. Thanks dan...
You can use
renderer.setDisplayValues(true);
This displays the %of distribution in the pie chart itself.
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.