在使用jfreechart时,运行demo时,点击后显示的所有tooltip都会将横坐标和纵坐标的值一起显示出来,中间以逗号分开
可是我在运行一个师兄写的一个timeseries panel时,点击某一个数据时,却只显示纵坐标的值,横坐标所标识的时间却不显示,请问可能出现的问题是什么啊??

解决方案 »

  1.   

    这个设置一下就行了。具体的我忘了,你自己查查。反正就是设置renderer的tooltip属性。
      

  2.   

    或者你构建一个ToolTipGenerator对象,然后把这个对象赋给chart的renderer对象。 JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo",
    "Category", "Value", dataset, PlotOrientation.VERTICAL, true,
    true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    StandardCategoryToolTipGenerator toolg = new StandardCategoryToolTipGenerator(
    "[{1},{2}]", new DecimalFormat("0.00"));
    renderer.setToolTipGenerator(toolg);
    我这里是对Category的chart进行设置toolTip的格式,对于timeseries 的大同小异,其中
    [{1},{2}]就是显示合纵坐标,如果去掉一个,就只显示另外一个。