XAxis label angle in MPAndroidChart causes chart to move up - android

When i use xAxis.setLabelRotationAngle(-45); to rotate the labels of the xAxis on a bar chart,it causes the chart to jump up on the charts.BarChart control.
Chart without label rotation
Chart with label rotation
How do i prevent this from happening while keeping the rotation?

Related

How to hide graph bottom labels in HorizontalBarChart?

I'm trying to hide the bottom labels from the HorizontalBarChart graph (in black border) using MPAndroidChart.
I tried setDrawLabels(false) for XAxis, YAxis left, YAxis right with no success.
What parameter should i change and set to false to hide this line?
It work when i disable the axis right from my horizontal bar chart.
// Right Y Axis
YAxis yr = chart.getAxisRight();
yr.setEnabled(false);
// yr.setDrawGridLines(false);
// yr.setDrawAxisLine(false);
// yr.disableGridDashedLine();
Try:
XAxis xl = chart.getXAxis();
//This will stop the grid lines from being drawn
xl.setDrawGridLines(false);
//This Will stop the labels from being drawn
xl.setDrawLabels(false);

How to plot chart in GraphView with no background?

How to make graphview background completely blank, not even show x axis and y axis.
couldn't find anything on web
I got my solution by adding these lines
mygraphview.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.NONE);// It will remove the background grids
mygraphview.getGridLabelRenderer().setHorizontalLabelsVisible(false);// remove horizontal x labels and line
mygraphview.getGridLabelRenderer().setVerticalLabelsVisible(false);
// remove vertical labels and lines

MPChart: x axis couldn't display date completely

I have a problem using MPChart :
x axis couldn't display the first date,could someone help me?thanks!
You can use the setAvoidFirstLastClipping(Boolean) from your chart to avoid your first and last labels to be truncated.
From the doc:
setAvoidFirstLastClipping(boolean enabled): If set to true, the chart will avoid that the first and last axis label entry in the x-axis "clip" off the edge of the chart or the screen.

XAxis label angle in MPAndroidChart

I am using MPAndroidChart library for my project.
Is it possible to rotate the labels of the XAxis by 270 degrees so that I can fit more text?
Original answer:
Unfortunately it is currently not possible to rotate the values on the x-axis of a chart to a certain degree / angle.
You will have to implement such a feature yourself.
UPDATE:
As of v2.1.5 this feature is now available:
XAxis xAxis = chart.getXAxis();
xAxis.setLabelRotationAngle(...);
do it simply by
XAxis xAxis=barChart.getXAxis();
xAxis.setLabelRotationAngle(-45);

How to rotate the x-axis label of bar-chart in android?

I'm using chart engine library to draw bar chart. X-Axis label has text values and it required more space. How can I tilt the x-axis values.
Have you tried:
renderer.setXLabelsAngle(ANGLE);
Where ANGLE is your desired text angle?

Categories

Resources