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

后端 未结 2 1497
终归单人心
终归单人心 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:21
    renderer.setBaseItemLabelGenerator(
    new StandardCategoryItemLabelGenerator()
     @Override
     public String generateLabel(CategoryDataset dataset, int row, int column) {
            return "Your Text" +row+","+column;
     }
    );
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题