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?

Était-ce utile?

La 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).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top