CategoryPlot plot = chart2.getCategoryPlot();
BarRenderer renderer = (BarRenderer) plot.getRenderer();
DecimalFormat decimalformat1 = new DecimalFormat("##,###.00");
renderer.setItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}",decimalformat1));
renderer.setItemLabelsVisible(true);
When this code was added....nothing happened
renderer.setItemLabelsVisible(true);
chart.getCategoryPlot().setRenderer(renderer);
Before setting the item labels visible, you need to first generate the labels by using setItemLabelGenerator, setStandardItemLabelGenerator.
These use decimalformat object to pass the value which handles the data format of the value.
No comments:
Post a Comment