Tooltips/mouseover

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
domxch
Posts: 1
Joined: Fri Jan 31, 2020 2:31 am
antibot: No, of course not.

Tooltips/mouseover

Post by domxch » Fri Jan 31, 2020 2:39 am

Hi,

I'm using JFreeChart with 2 TimeSeries.
Everything works great but I have tried implementing the built-in tooltips as part of my attempts to do some processing when the mouse is moved over the data points.
So far as I can see this should be quite a trivial task but I've so far not been able to display any tooltips, either with my class, or even by adding them to any standard JFreeChart examples I downloaded.

From what I understand all that is required is to add the tooltip to the plot renderer:-

XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
plot.setRenderer(renderer);

And then create the chart with the correct parameters:-

JFreeChart chart = ChartFactory.createTimeSeriesChart(
"Closing price by time",
"DateTime",
"Closing price (€)",
dataset, true, true, false
);

Any suggestions greatly appreciated as this should be really simple...

Locked