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!)
ToolTips
Re: ToolTips
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.
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.
Re: ToolTips
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.
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
...to:
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES));
...and see if you get tooltips.
Regards,
DG.
Re: ToolTips
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
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
Re: ToolTips
you have to add the chart to a jfreechartpanel and set the tool tip flag to true.
Re: ToolTips
Is they any sample code I can use to display tooltips. I try the above but didn't work.