how to display customized values on a bar in bar chart using jfree chart?

后端 未结 2 1501
终归单人心
终归单人心 2021-01-15 11:35

By using StandardCategoryItemLabelGenerator() Iam able to display the exact range axis value on a bar, Now my problem is I dont want to display the range axis value instead

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-15 12:28

    StandardCategoryItemLabelGenerator uses an instance of MessgeFormat for this, defaulting to ArgumentIndex {2}. The other ArgumentIndex values are defined in the abstract parent. For example,

    renderer.setBaseItemLabelGenerator(
        new StandardCategoryItemLabelGenerator(
            "{0} {1} {2} {3}", NumberFormat.getInstance()));
    renderer.setBaseItemLabelsVisible(true);
    

    You can also override generateLabel() to return any value you want.

提交回复
热议问题