import com.imsl.chart.*; import java.awt.image.BufferedImage; import java.io.File; public class SampleImageIO { public static void main(String argv[]) throws java.io.IOException { Chart chart = createChart(); chart.setScreenSize(new java.awt.Dimension(500,500)); BufferedImage bi = new BufferedImage(500, 500, BufferedImage.TYPE_4BYTE_ABGR_PRE); chart.paintChart(bi.createGraphics()); File file = new File("SampleImageIO.png"); javax.imageio.ImageIO.write(bi, "PNG", file); } static Chart createChart() { Chart chart = new Chart(); AxisXY axis = new AxisXY(chart); int npoints = 20; double dx = .5 * Math.PI/(npoints-1); double x[] = new double[npoints]; double y[] = new double[npoints]; // Generate some data for (int i = 0; i < npoints; i++){ x[i] = i * dx; y[i] = Math.sin(x[i]); } new Data(axis, x, y); return chart; } }