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

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?

Related

Make the miniature squares under a barGraph scrollable using mpandroidchart

I have a barGraph similar to the one below.
I was wondering if the miniature ( maybe the word is not accurate, I'm talking about the little coloured squares under the x axis, on the left of the word "Company" on the picture ) can be set to scrollable when the graph contains a lot of datas.
If so, is there as well a way to set those squares touchable and on touch, to center the view on the corresponding element of a barGraph?
I add that the graph itself is and has to be scrollable.
Thanks in advance.
The little squares you are talking about represent the Legend which shows the different datasets used.
It is not possible to make this scrollable by default.
What you could do is create your own miniature BarChart below your actual barchart and use that one.

GraphView y-axis label flicker and space on top with empty title?

Two questions regarding the GraphView library.
1) With manual setNumVerticalLabels set when switching from scrolling to scaling and vice versa, that the labels for my y-Axis change it's position. In scrolling mode they are closer together and in scaling mode a bit further apart.
In case of having the number of labels set automatically, the number of labels also changes between the two modes.
Is this a known bug? Is there any way to get around that behavior?
2) Is it possible to claim the space above the graph for the graph if the title is left empty?
Thanks for any help!
1) that is because your labels could need more space. You have 2 options:
a) set a fixed width for the vertical labels
or b) make sure that the labels have a fixed/limited count of characters via custom label formatter.
2) this is not possible with GraphView 3.x, but in GraphView 4.0 this is be fixed.

achartengine change location of origin

I'm drawing a BarChart with AChartEngine on Android.
I made the chart horizontal by changing the orientation of the XYMultipleSeriesRenderer:
mMSRenderer.setOrientation(Orientation.VERTICAL);
(it seems counter-intuitive that horizontal is set with Orientation.VERTICAL, but that's not the point of my question).
The origin of the plot is on the top left corner, while I would like it in the bottom left, so that values go increasing from the bottom to the top.
Is this possible?
This is not possible with AChartEngine as it is out of the box.
However, you can try to put your data in your dataset in a reversed order and add custom labels instead of the default ones.

Trouble getting axis centered on Origo in AChartEngine

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.

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

Categories

Resources