ToolTips

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Rob Desilets

ToolTips

Post by Rob Desilets » Thu Apr 04, 2002 2:29 am

When I fly my mouse over a data point for a XYPlot, is there a way for a ToolTip to pop up and tell me the exact value of the data under my mouse cursor? It seems that JFreeChart supports "ToolTips", but I am not sure in what capacity.

Thanks a bunch!

Rob

(P.S. I love this charting package!)

David Gilbert

Re: ToolTips

Post by David Gilbert » Thu Apr 04, 2002 11:41 pm

Hi Rob,

Tooltips are enabled by default in JFreeChartPanel for many plot types. If you are using XYPlot with the StandardXYItemRenderer then you'll only get tooltips if the renderer is using SHAPES or SHAPES_AND_LINES (but not LINES). I can probably fix it so that it generates tooltips for LINES as well...

Regards,

DG.

David Gilbert

Re: ToolTips

Post by David Gilbert » Thu Apr 04, 2002 11:44 pm

The above might be a little obscure. If you are using ChartFactory.createXYChart(...) to create your charts, then change this line in that method:

plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES));

...to:

plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES));

...and see if you get tooltips.

Regards,

DG.

Young-Jin Lee

Re: ToolTips

Post by Young-Jin Lee » Mon Apr 08, 2002 4:27 pm

I changed the plot.setXYItemRenderer() method call of createXYChart() method in ChartFactory.java as you suggested. But tooltip did not appear. All I found was the width of xyplot becamd thicker than before.

Am I missing something?

Moreover, the width of plotting line is too thick. Is there any way to see the tooltip without using plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES))?

Thanks in advance.

Young-Jin

josh

Re: ToolTips

Post by josh » Thu Apr 25, 2002 9:14 pm

you have to add the chart to a jfreechartpanel and set the tool tip flag to true.

kar yeow

Re: ToolTips

Post by kar yeow » Fri May 24, 2002 11:25 am

Is they any sample code I can use to display tooltips. I try the above but didn't work.

Locked