I have posted this issue before but the developer reply does not help me,
https://github.com/PhilJay/MPAndroidChart/issues/681
I am using Horizontal Bar Chart, when using large values in Y axis values, these values have a cutoff and are partially drawn outside the screen.
horizontalbarchart

The same thing happens in Line chart, when clicking marker view to see its values, the right most marker view is partially drawn outside the device screen.
linebarchart

Set bigger offsets or change the y-axis range - it's all in the documentation.
I am having the same issue as in the first screen shot. I am using HorizontalBarChart. I am using the following code:
BarData data = new BarData(labels, dataset);
data.setValueFormatter(new MyValueFormatter());
chart.setData(data);
XAxis xAxis = chart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); //bottom is good
xAxis.setDrawGridLines(false);
xAxis.setDrawAxisLine(false);
YAxis yAxis = chart.getAxisLeft(); // upper part
yAxis.setEnabled(false);
yAxis = chart.getAxisRight(); // lower part
yAxis.setEnabled(false);
chart.setDrawGridBackground(false);
chart.setDescription("");
chart.getLegend().setEnabled(false);
chart.setTouchEnabled(false);
chart.animateY(5000);
chart.invalidate();
the class MyValueFormatter returns this-
mFormat.format(value) + " votes";
Here, in the maximum value, e.g "7 votes", I get "7 vote".
I even tried to set a limited layout_width and left blank space to my right and then used android:clipChildren="false" but still the text animates and cuts just on the border of the HorizontalBarChart.
thanks for replying but I'm afraid I'm still confused.
first of all, in horizontal bar chart, the x axis shows the bars and their values as seen by the following code. the said position has effect on the position of the text values.
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
but you're referring to a page of y axis. Yet I've gone through the guides for both axes and for the generic axis but failed to find a solution. Please guide me.. I've made a whole app dependent on this module but now I'm stuck.
maybe I'm missing a very minor thing but I've spent hours on this issue with no fruitful result.
I haven't found a way to solve this issue either. My value gets cut off at the right end of my bar charts when the value is close to the maximum, and setting offsets does not solve the issue.
I've given up this module and made my own layout using progress bars.
I fixed this using:
setViewPortOffsets(float left, float top, float right, float bottom)
https://github.com/PhilJay/MPAndroidChart/wiki/Modifying-the-Viewport
:)
My dataset value text are also being truncated, since I have my own custom value formatter which added more characters to the default one. I'm on 3.0, is there no way to shrink the bars to fit the text?
Try this:
mChart.setExtraRightOffset(30f);
@WTDIndia please do NOT POST CODE on old issues and expect someone to come along and fix everything for you. This issue has been resolved, as Philip originally said that adding extra offset to the chart fixes this. Again, do not do this kind of stuff on issue trackers, no one likes it.
Also, please don't dislike the correct answers, it does nothing but waste everyone's time.
Most helpful comment
Try this:
mChart.setExtraRightOffset(30f);