Trouble getting axis centered on Origo in AChartEngine - android

I'm having trouble getting AChartEngine to center the actual visible axises on Origo instead of having them along the left- and bottom of the chart.
I need to have the axises like so:
Any ideas?
(This question is similar to question #2 [2]: Make x-axis in vertical center using AChartEngine but I thought that a more specific question might get an answer)

I made some modifications to AChartEngine 1.0.0 to make it possible to display axises in the center of the plot.
Use code below to set the axises to center.
XYMultipleSeriesRenderer.setXAxisAlign(Align.CENTER, 0);
XYMultipleSeriesRenderer.setYAxisAlign(Align.CENTER, 0);
XYMultipleSeriesRenderer.patch
XYChart.patch
And here is an example on how it may look

There isn't a better answer than the one you mentioned. Just make sure that you calculate X and Y ranges such as your data fits inside and also make sure that the range you set is centered on the 0 point:
renderer.setXAxisMin(-value);
randerer.setXAxisMax(value);
and the same for the Y axis.

Related

how to plot a graph from right hand side in android ,

I have to draw a graph on android with:-
X-axis's labels starting from the right-hand side of the graph and
ending to the left. (i.e; label with low value positioned on the
right while labels with higher values positioned left)
Y-axis positioned on the right side of the graph.
I have tried graphview (library) in android but could not find a way to plot x-axis from right to left manner. (As explained above) However, managed to plot Y-axis. (As managed above).
Tried MPChart (library as well) unfortunately that also did not work.
Any suggestion or idea will be a great help.
I am attaching the image as well for you to understand what exactly I want my graph to look like.SEE IMAGE HERE
If the input data is not dynamic you can always graph it it in reverse order by reversing the Array/List and plotting it normally. I've had to use some hack around code to rotate my Graph to make the x axis on the left and y axis on the bottom using MPAndroidChart. But it seems like you already tried attempted that solution, so I honestly would just reverse graph it.
Something like : Collections.reverse(Arrays.asList(a));
"For all my graphing needs I used: MPAndroidChart
This guy made a awesome library and so easy to implement it has really good doceumation to get started found here: MPAndroidChartDocumentation"

How to change position of y-axis label using mpandroidchart library?

I've searched the wiki, SO, the issues section of https://github.com/PhilJay/MPAndroidChart/issues, but have been unable to find an answer to my question.
I simply want to change the position of the y-axis values above the horizontal grid lines. I can move them into the graph with leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART), but there doesn't seem to be any way to move their position vertically.
Here is what I am trying to achieve:yaxis_label_above
Here is what it currently looks like:
yaxis_label_on_line
Is it possible to move the position of the y-axis labels vertically either up or down?
The AxisValueFormatter interface (Link)
More details please refer to How can I alter the spacing for the Y-Axis Labels in MPAndroidchart?

Add right Yaxis in achartengine?

I have task is chart in picture.
My problem is how to add Y Axis in right same PDF in picture.
please tell me how to do that.
Thank for watching!
Your second line chart will have to use a different scale and the Y axis align for the second scale must be on the right. Take a look at this example for a working piece of code. The example builds a chart like the one below.

achartengine - inclined labels position

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);

Apply a programmatic pan with achartengine

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

Categories

Resources