views:

207

answers:

1

Hi All,

I am using JFreeChart to generate images. I am trying to create barchart like below. I am able to create it successfully without data table. I tried to get more information from the jfreechar forums and found this post. According to the post , its not supported by JfreeChart.

  • Is it still not supported by jfreechart API ?
  • If yes, can I use any other charting (open source) tool to generate chart with data table ?

Thanks

alt text

+1  A: 

I'm not aware of a anything new in this area. One simple approach is to rely on the default CategoryToolTipGenerator or customize it as desired:

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

A more ambitious approach would be to add a JTable having a TableModel with access to your chart's CategoryDataset. A TableCellRenderer for the leftmost column might use the BarRenderer's getSeriesPaint(). This example shows a custom renderer that implements the Icon interface to do the drawing.

trashgod
Thanks @trashgod , I'll look into that.
TuxGeek