How to set up tooltip for CategoryPlot elements in JFreeChart?

I need to change the default tooltip format in the lines drawn on the chart graph.

I do not know if I am looking at the problem correctly. I am considering the default format for the StandardCategoryToolTipGenerator class, which

 DEFAULT_TOOL_TIP_FORMAT_STRING = "({0}, {1}) = {2}" 

How can I override this value?

Thanks in advance.

+1
source share
1 answer

StandardCategoryToolTipGenerator sets MessageFormat ArgumentIndex values ​​for the series, category, and value. Try this example on your plot.

 BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator( "Series {0}, Category {1}, Value {2}", NumberFormat.getInstance())); 
+2
source

All Articles