Drill down?

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

Drill down?

Post by Russ Ferriday » Mon Mar 11, 2002 8:18 pm

This looks like a great project.
Is drill-down support provided or envisioned?
--r.

David Gilbert

Re: Drill down?

Post by David Gilbert » Wed Mar 13, 2002 10:29 am

Hi Russ,

There is an option to capture tooltip region information as a chart is being drawn...in time I'd like to generalise this to provide a translation between a mouse click and a data item on the chart, then allow developers to hook in their own code to react to such events.

Regards,

DG.

Hari

Re: Drill down?

Post by Hari » Mon Mar 18, 2002 6:29 am

Hi David,

I'm using JFreeChart to generate (chart) images for HTML pages using servlet.

I tried drill-down by providing values to "handleClick( x, y, null)" method and I got the null pointer exception while getting the output stream.

Part of my code is given below.

================

<...snip...>

AffineTransform saved = chartGraphics.getTransform();
chartGraphics.translate(0, 0);
if (scale) {
chartGraphics.transform(
AffineTransform.getScaleInstance(scaleX, scaleY));
}
mychart.draw(chartGraphics, chartArea, null);
chartGraphics.setTransform(saved);

if( clickX > 0 && clickY > 0) {
System.err.println( "Click at " + clickX + ", " + clickY);
mychart.handleClick( clickX, clickY, null);
//mychart.draw(chartGraphics, chartArea, null);
}
chartGraphics.drawImage(chartImage,0, 0, null );

ByteArrayOutputStream baos = new ByteArrayOutputStream();
ChartUtilities.writeChartAsJPEG( baos, mychart, Xwidth, Yheight);
byte[] ret = baos.toByteArray(); /* ret is NULL??? */

response.getOutputStream( ret);

<...snip...>
========================

The ret[] byte array become null in my case. Is the code is right or am I missing anything?

Thanks for your help!

Regards,

Hari.

Locked