Remove point labels from Line chart using MPAndroidChart library

13,776

Solution 1

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

Solution 2

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

Solution 3

i use this it worked for me

   dataSet.setValueFormatter(new DefaultAxisValueFormatter(0));

or

dataSet.setValueFormatter(new DefaultValueFormatter(0));

hope this help you

Share:
13,776
karuppiah
Author by

karuppiah

Updated on June 13, 2022

Comments

  • karuppiah
    karuppiah almost 2 years

    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?