Question

enter image description here

I have a stacked bar chart like in the image above. What i need is to show both series names and values on each bar. How can i do that?

I can show series with this code:

renderer.setBaseItemLabelGenerator(
            new StandardCategoryItemLabelGenerator("{0}", NumberFormat.getInstance()));
Était-ce utile?

La solution

I found the way to show both of them. The trick is to define each parameters format sequentially. Here is the code:

       renderer.setBaseItemLabelGenerator(
new StandardCategoryItemLabelGenerator("{0} {2}", NumberFormat.getInstance(),NumberFormat.getNumberInstance()));
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top