MPAndroidChart - Adding labels to bar chart

前端 未结 4 2054
北恋
北恋 2020-11-30 09:01

It is necessary for my application to have a label on each bar of the bar chart. Is there a way to do this with MPAndroidChart? I could not find a way to do this on the proj

4条回答
  •  旧时难觅i
    2020-11-30 09:49

    You can use IndexAxisValueFormatter to make things easier.

    final String[] labels = new String[] {"Dummy", "Jan", "Feb", "March", "April", "May",
        "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"};
    xAxis.setValueFormatter(new IndexAxisValueFormatter(labels));
    xAxis.setGranularity(1f);
    xAxis.setGranularityEnabled(true);
    

提交回复
热议问题