ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Chart.makeChart debugging
Posted by Clifton Sothoron on Oct-08-2011 05:23
In Java Chart.makeChart returns a boolean to indicate whether or not the chart creation
was successful.  Is there a way to determine why the chart creation failed?  Is some sort of
debug mode available?

Thanks in advance,

Clifton Sothoron

LogiXML Inc.

  Re: Chart.makeChart debugging
Posted by Peter Kwan on Oct-09-2011 14:15
Hi Clifton,

You can use the following method to output the JPG image directly to a OutputStream:

OutputStream f = new FileOutputStream(filename);
OutputStream s = new BufferedOutputStream(f);
c.makeChart3().outJPG(s);
s.close();
f.close();

The above code will throw an I/O Exception if there is any error. By examining the exception, you may determine the cause of the problem.

One possible reason for the issue is because the Java VM does not have the JPEG codec "com.sun.image.codec.jpeg.JPEGCodec". This codec exists on Java 1.2 or above, but may or may not be available for Java VM not come from SUN/Oracle.

Since Java 1.4, there is another codec javax.imageio.ImageIO. If you only need to support Java 1.4 or above, you can use javax.imageio.ImageIO to create the JPEG file as well. The code is like:

javax.imageio.ImageIO.write((BufferedImage)c.makeImage(), "jpg", new File("myimage.jpg"));

Again, the above code can throw exceptions. By examining the exception, you may determine the cause of the problem.

Hope this can help.

Regards
Peter Kwan