How to hide legends and axis in MPAndroidChart?

前端 未结 7 665
栀梦
栀梦 2020-12-13 11:54

Is their any possibility to hide all rounded items from this picture.

\"enter

相关标签:
7条回答
  • 2020-12-13 12:40
    chart=(LineChart) findViewById(R.id.Chart);
    chart.getLegend().setEnabled(false); // for hiding square on below graph
    
    0 讨论(0)
  • 2020-12-13 12:42

    Following code work for all chart

    Legend l = mchart.getLegend(); l.setEnabled(false);.

    0 讨论(0)
  • 2020-12-13 12:42

    Below code works for PieChart. Try to get same method for your Chart.

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.NONE);
    
    0 讨论(0)
  • 2020-12-13 12:44

    It appears mChart.SetDescription() no longer accepts a String.

    The method now accepts an instance of the Description Class like this: mChart.setDescription(Description description)

    So to modify or delete the Chart Description you may do it like below

    Description description = new Description();
    description.setText("");
    mChart.setDescription(description);
    
    0 讨论(0)
  • 2020-12-13 12:45

    Yes, is possible, just using following code:

    mChart.setDescription("");    // Hide the description
    mChart.getAxisLeft().setDrawLabels(false);
    mChart.getAxisRight().setDrawLabels(false);
    mChart.getXAxis().setDrawLabels(false);
    
    mChart.getLegend().setEnabled(false);   // Hide the legend 
    
    0 讨论(0)
  • 2020-12-13 12:47

    To hide description, use this

    mChart.getDescription().setEnabled(false)
    
    0 讨论(0)
提交回复
热议问题