Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove point labels from Line chart using MPAndroidChart library

I am working on designing a Line chart using the MPAndroidChart library. in that chart, the "points labels" should be removed or suppressed, and once we click that point circle the marker should be displayed. However, right now it displays the point labels on each point circle, so what I need is to show the point in the marker only once it is clicked. Also, while I've tried to customize the chart the Y-axis points are displayed as float; I have tried to display them as int but that won't work.

How can I fix this?

like image 998
karuppiah Avatar asked Aug 14 '15 10:08

karuppiah


3 Answers

I found the answer at last. We have to add set1.setDrawValues(false); in LineDataSet value properties. This will make the changes, as the points are not displayed.

LineDataSet set1 = new LineDataSet(yVals1, "");
set1.setDrawValues(false);
ArrayList<LineDataSet> dataSets = new ArrayList<LineDataSet>();
dataSets.add(set1); // add the datasets
like image 86
karuppiah Avatar answered Oct 04 '22 12:10

karuppiah


If you want to keep the value but remove the Label (as it may already exist in the legend) the do mChart.setDrawEntryLabels(false);

like image 34
suku Avatar answered Oct 04 '22 11:10

suku


i use this it worked for me

   dataSet.setValueFormatter(new DefaultAxisValueFormatter(0));

or

dataSet.setValueFormatter(new DefaultValueFormatter(0));

hope this help you

like image 38
Sameer Muslim Avatar answered Oct 04 '22 13:10

Sameer Muslim