The axes have been hidden by calling
setShowAxes(false);
But as you can see, there are still some small dash lines on the axes. Is there any way to hide these line as well?
Those dashes drawing along with labels so it is impossible to get rid of them without clearing label names or changing source code. If it is okay to clearing labels you can use:
renderer.setShowLabels(false);
Related
I use achartengine in my Android application and has been able to draw few line charts. Now I need to draw some kind of threshold line which basically an extra line in red that will run at certain Y value across the graph.
I read other questions regarding threshold lines but mostly about bar chart to have different color above and below threshold line. I need it for line chart and I don't need different color above and below the threshold line.
I can definitely draw it as another line, but I don't want legend for this shows up while I still want legend for others show up. Is there any way to do this? I don't know if there is built-in functionality to draw the threshold line. Or at least a way to hide legend for only one line.
Any input, suggestion or direction will be very appreciated. Thank you.
Got it. If anyone needs to do the same thing, this is what I do:
if(i == theIndexForThresholdLine) {
renderer.getSeriesRendererAt(i).setShowLegendItem(false);
}
That will turn off legend only for that item.
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.
I'm using achartengine to show a temperature graph. on X axis I put dates, to fit them I call setXLabelsAngle(45); this is the result:
As you can see, the labels are placed too high and go over the x-Axis. How could I fix this? I'm already using setMargins(), but labels don't move, only legend does.
This will help:
renderer.setXLabelsAlign(Align.LEFT);
As of right now if I have a line chart value that is straight horizontal or vertical and happens to be the exact value as one of the grid lines, then it becomes really tough to see. Is there any way to change the Z order of how things are drawn such that everything draws over the grid lines?
No, there isn't such API.
However, you can play with the colors, for instance set some transparency level of the grid lines color, axes color.
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.