-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am using jfreechart using imagemap in the zul file. Everything is done now the only problem I have is to get a tooltip when I move the mouse on a datapoint. I am using imagemap and its a simple XY line chart.
Here is my code:
Zul code:
<imagemap id="myimage">
</imagemap>
Javacode:
........
JFreeChart chart = trackerGraph.createChart(chartData, addEditTrackerVO.isTimeFieldVisible());
XYLineAndShapeRenderer r = new XYLineAndShapeRenderer();
r.setToolTipGenerator(new StandardXYToolTipGenerator());
chart.getXYPlot().setRenderer(r);
trackerGraph.createGraph(myimage, chart);
..........
public void createGraph(Imagemap myimage, JFreeChart chart){
try {
ChartRenderingInfo info = new ChartRenderingInfo();
BufferedImage bi = chart.createBufferedImage(600, 400, BufferedImage.TRANSLUCENT, info);
//BufferedImage bi = chart.createBufferedImage(500, 300, BufferedImage.TRANSLUCENT , null);
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
AImage image = new AImage("Line Chart", bytes);
myimage.setContent(image);
}catch (Exception ex){
LOG.info("Exception!! while creating jfreeChart. The exception is: "+ex.getMessage());
}
}
public JFreeChart createChart(ChartData chartData , boolean isTimeFieldVisible) {
XYDataset dataset = createDataset(chartData, isTimeFieldVisible);
Plot plot = createPlot(chartData, dataset, isTimeFieldVisible);
return new JFreeChart(chartData.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, createLegend(chartData));
}
public void writeChart(OutputStream out, JFreeChart chart, ChartData chartData) throws Exception {
ChartUtilities.writeChartAsPNG(out, chart, chartData.getWidth(), chartData.getHeight());
}
What am I missing? How can I get a tooltip when I move my mouse over a datapoint on the graph?
I will really appreciate if you could provide some help.
Regards,
Kazim
Asked: 2010-06-01 22:59:45 +0800
Seen: 1,695 times
Last updated: Jun 03 '10