Question

enter image description here

I have a stacked bar chart like in the image above. What i need is to show column keys ("Series 1","Series 2","Series 3") on the bars instead of their values. How can i do that?

Was it helpful?

Solution

You can do this:

renderer.setBaseItemLabelGenerator(
            new StandardCategoryItemLabelGenerator("{0}", NumberFormat.getInstance()));

The label generator works off a template where it replaces instances of '{0}' with the series name, '{1}' with the category key, and '{2}' with the data value. The number formatter passed to the constructor is used for formatting the data values (but in your case, the data value is not displayed so the formatter will not be used).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top