Gokul Kulkarni
Gokul Kulkarni

Reputation: 2239

MPAndroidChart BarChart bars getting cut off

I am using MPAndroidChart for drawing a chart in my Android App.

One requirement is I need to bar chart starting from non-zero y position, as suggested in this. So I had using CandleStickChart for the same. Now my bars are getting cut off at the start and end.

Is there any way to give padding at the start and end of the graph so that it does not get cut off.

Note: My XAxis values are like "4Nov", "5Nov"...

Upvotes: 5

Views: 3623

Answers (2)

What worked for me is increasing the SpaceTop value.

var yaxis = chart.AxisLeft;
yaxis.SpaceTop = 1.35f;

Upvotes: 0

Gokul Kulkarni
Gokul Kulkarni

Reputation: 2239

After trying many things, I found out this solution,

graph.getXAxis().setAxisMaximum(candleData.getXMax() + 0.25f); graph.getXAxis().setAxisMinimum(candleData.getXMin() - 0.25f);

Upvotes: 7

Related Questions