I want to create a coordinate system like this:
http://xahlee.info/SpecialPlaneCurves_dir/CoordinateSystem_dir/rectangular_coord.png
I tried creating it with AndroidPlot, but I couldn't figure out how.
My main problems: I can't figure out how to draw negative x-values and how to keep the x/y-axis permanent on the screen, even when zooming.
Does someone have an solution for this?
Try this
plot.centerOnDomainOrigin(0);
plot.centerOnRangeOrigin(0);
where plot is XYPlot .
Related
Below is the chart I am trying to create using MPAndroidChart library:
required_graph
To create this graph, I need some way to tell the linechart to only show two y-values "Average" and "You". I also need a way to draw a vertical grid-line that only goes up to the circle/y-value. I have searched for tutorials, SO articles, issues on MPAndroidChart github as well as the wiki, but I'm still uncertain how to create the graph above. Is there a way to create this graph with MPAndroidChart? Any help is much appreciated.
Try creating multiple data sets and style them differently. The 1st one should contain all the values, including "Average" and "You", enable fill color and disable drawing the circles.
Then, create a new set with a single value (average) and give it a different style. Do the same with the "you" value.
Good luck !
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.
Is there a way I can apply a pan from code? I want my pie chart to initially display a little off center (down a little bit). Can I do that?
Have a look at renderer API. I guess you should use setInitialRange(double[] range, int scale) function, but I can't be sure from your question: do you mean to 'offset' initially displayed data inside graph or to change whole chart position (a little below) ?
Maybe posting an image could help to understand your need
On Androidplot my Axis Vals are cut off, so the last values are only shown half.
How to fix this issue?
In case the solution by Coretek doesn't work for you, as it did not for me, I found this solution to produce the desired output:
YOURPLOT.getGraphWidget().setGridPaddingRight(AmountOfSpaceDesired);
YOURPLOT.getGraphWidget().setGridPaddingTop(AmountOfSpaceDesired);
This will not just move your axis to no longer be cut off, but also your graph. I wanted a little extra space on the top where I previously had a point touching along with the right side where another point was touching.
I hope this can help someone as it has helped me.
dynamicPlot.getGraphWidget().setMarginTop(4);
dynamicPlot.getLegendWidget().setHeight(14);
Luckly I still found something in the androidplot forums cache.
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.