Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 saving the FinOHLCPlot as image
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pb_1

1 Posts

Posted - 10 Apr 2008 :  02:08:24  Show Profile  Reply with Quote
I am trying to save the FinOHLCPlot from the
QuinnCurtis\java\com\quinncurtis\chart2djava\examples\financialexamplesas image. But it is giving me the error:
Exception in thread "main" java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.awt.image.BufferedImage.<init>(Unknown Source)
at com.quinncurtis.chart2djava.ChartBufferedImage.render(ChartBufferedImage.java:154)
at com.quinncurtis.chart2djava.examples.financialexamples.FinOHLCPlot.SaveJPEG(FinOHLCPlot.java:422)
at com.quinncurtis.chart2djava.examples.financialexamples.FinOHLCPlot.main(FinOHLCPlot.java:428)

How do I save this high-low-open-close plot as a image. Can you please help me with this? Please let me know if you need any more clarifications.

quinncurtis

1164 Posts

Posted - 10 Apr 2008 :  09:39:54  Show Profile  Reply with Quote
Saving a chart as an image has nothing to do with the chart type.

I would guess that you are trying to save the chart before it has actually been drawn. Defining the chart, as done in the FinOHLCPlot constructor of the example, does not draw it. The chart is drawn in response to the windows draw event later on. Until the chart is drawn, it does not have a size. Add a menu to the application and then invoke the examples SaveAsJPeg function from the menu. That way, you can see the chart when you invoke the SaveAsJPeg routine.

The tutorial example, LinePlotSalesVolume has a simple example of saving a chart as an image. You should run that and select File | Save As Jpg from the charts simple menu. Once you verify it works, study the code, then either add the appropriate code to your own program, or replace the exisiting chart in the LinePlotSalesVolume with the FinOHLCPlot chart.

This discussion assumes that you actually want to display the chart on the screen. Specify if it is otherwise.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07