MPAndroidChart PieChart how to set label text?

前端 未结 5 567
忘了有多久
忘了有多久 2021-01-05 07:28

got the following code:

    Legend legend = mChart.getLegend();
    legend.setLabels(new String[]{\"aaaaa\", \"bbbbb\", \"ccccc\"});

This s

5条回答
  •  悲哀的现实
    2021-01-05 07:59

    You can set custom labels with colors:

    First make sure Legend is enable. Unless enable legend.

    legend.setEnabled(true);
    

    With com.github.PhilJay:MPAndroidChart:v3.0.0:-

    legend .setCustom(ColorTemplate.VORDIPLOM_COLORS, new String[] { "aaaaa", "bbbbb", "ccccc"});
    

    setCustom(int[] colors, String[] labels): Sets a custom legend's labels and colors arrays. The colors count should match the labels count. Each color is for the form drawn at the same index.

提交回复
热议问题