How to customize a tooltip of CategoryPlot items in JFreeChart?

﹥>﹥吖頭↗ 提交于 2019-12-17 20:15:58

问题


I need to change the format of the default tooltip in the bars drawn in the plot of a chart.

I don't know if my direction of looking at the problem is right. I am looking at the default format for the class StandardCategoryToolTipGenerator that is

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

How can I redefine this value?

Thanks in advance.


回答1:


The StandardCategoryToolTipGenerator sets the MessageFormat ArgumentIndex values to 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()));


来源:https://stackoverflow.com/questions/8925975/how-to-customize-a-tooltip-of-categoryplot-items-in-jfreechart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!