Mouse over graphics in jfreechart
1 answer
Getting this data depends on where you are using the chart. In a swing application, use mouse listeners from the pane that displays the chart.
On a web page using an image, you won't be able to get the data (since it is only an image), but JFreeChart will create an image map for you that can call the java script on hover.
In a recent project, I did something like:
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
String pngLocation = Servlet.saveChartAsPNG(chart, 200, 200, info, request.getPortletSession());
StringWriter sw = new StringWriter();
ChartUtilities.writeImageMap(new PrintWriter(sw), pngLocation, info, false);
Here chart
is a JFreeChart with appropriate flags for what you are trying to do (tooltips, urls, labels)
0
a source to share