Vaibhav Singhal
Vaibhav Singhal

Reputation: 908

Data points on linegraph in MPAndroidChart are cropped

I am using the MPAndroidChart library to plot some data on a line chart. Everything is perfect except for the fact that the data points, marked in circles are getting cropped at the extremities of the graph.

Here's a screenshot:

enter image description here

My code for formatting the chart is as below:

lineChart.setDescription("");
lineChart.setTouchEnabled(false);
lineChart.getLegend().setEnabled(false);
lineChart.setDrawGridBackground(false);
lineChart.setHardwareAccelerationEnabled(true);
lineChart.setNoDataTextDescription(INSUFFICIENT_DATA_TEXT);
lineDataSet.setColor(COLOR.RED);
lineDataSet.setCircleColor(COLOR.RED);
lineDataSet.setCircleColorHole(COLOR.RED);

xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(true);
xAxis.setTextSize(5);
xAxis.setAvoidFirstLastClipping(true);
xAxis.setLabelCount(4);
xAxis.setStartAtZero(false);
xAxis.setDrawGridLines(true);

yLeftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
yLeftAxis.setTextSize(CHART_LABEL_SIZE);
yLeftAxis.setDrawLabels(false);
yLeftAxis.setDrawAxisLine(false);
yLeftAxis.setDrawGridLines(false);

Upvotes: 2

Views: 1637

Answers (1)

Vaibhav Singhal
Vaibhav Singhal

Reputation: 908

Actually, not to worry. There seems to be a bug in v2.0.8. Switching to v2.0.7 did the trick.

Ref: https://github.com/PhilJay/MPAndroidChart/issues/447

Upvotes: 4

Related Questions