Chris D Chris D - 5 months ago 166
Android Question

Set Max X Value for Horizontal Bar Chart

I am working with the MPAndroidChart library and I am trying to produce a Horizontal Bar Chart with only one item in the data set. The issue I am running into is setting the max value for the x-axis. I would like to say the max X value is 1000 and if the value in the data set is 500 then the bar chart would only go 1/2 way across the screen. My issue is that I can't seem to find a way to set the max value of the x axis for the Horizontal Bar Chart in the MPAndroidChart library.

Answer

I know this is kind of misleading, but for the HorizontalBarChart, this needs to be set via the y-axis :-)

Here is the full documentation of the YAxis.

Check out the setAxisMaxValue(float max) method.

Comments