Create Image Map of Chart

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

Create Image Map of Chart

Post by shahzad sarwar » Wed May 01, 2002 7:21 pm

Hello all,

If there a way to create a servlet that will first send out the
html for the chart with image map and then call back for the graph.

I have seen other packages that do this. Just can not figure out
if jfreechart has this.

Thanks a lot
Shahzad

Michael T

Re: Create Image Map of Chart

Post by Michael T » Fri May 03, 2002 7:15 am

I was looking into this myself. I was trying to somehow use the tooltips for this but was unable to figure out how to get at them. They seem to be generated and stored in the DrawInfo object (and would be highly dependent upon what height and width were used).

How can I access this from an existing chart? (I haven't traced all the way through the code yet.) I'm also not sure why JFreeChart.generateBufferedImage() (called by ChartUtilities.writeChartAsPNG()) passes a null instead of a DrawInfo object to chart.draw(). I haven't yet looked into what the Plot object was doing because I ran out of time today.

David Gilbert

Re: Create Image Map of Chart

Post by David Gilbert » Fri May 03, 2002 9:45 am

The idea of the DrawInfo object is that it collects information about the dimensions of the chart for a particular call to the draw(...) method. If these dimensions were stored in the chart/plot objects, then you would have to know where the chart was last drawn...was it drawn on a JFreeChartPanel, to a Graphics2D from some printer job, to an image?

The JFreeChartPanel stores the DrawInfo object from the last redraw *to the panel* so that it can generate tooltips. I plan to generalise the tooltip information so that it can be used for other purposes...for instance, I have some code from another developer that allows you to click on items within a chart and find out information about the item via a callback method.

Sometimes I pass in null for the DrawInfo object - this avoids the overhead of collecting dimension information if it is not going to be used (and it isn't used when creating a PNG image file).

Regards,

DG.

Locked