Charts can be saved as jpg or png images.
This is the codeblock for saving a chart to an image.
An IOExpetion must be catched in case the storage device is full or write protected.
//saving the chart as jpg and png in the current working directory
try {
chart.saveAsJPEG("testchart.jpg", 640, 480);
chart.saveAsPNG("testchart.png", 640, 480);
} catch (IOException ex) {
Logger.getLogger(JChartLibApp_SaveAsJpg.class.getName()).log(Level.SEVERE, null, ex);
}
Sourcecode sample application:
/**
import com.bitagentur.data.JChartLibSerie;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
A simple demonstration application showing how to create a line chart.
*
*/
public class JChartLibApp_SaveAsJpg {
/**
/**