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()));
Was it helpful?

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()));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top