import com.imsl.chart.*; import java.awt.*; import javax.media.jai.*; public class SampleJai { public static void main(String argv[]) { Frame frame = new Frame(); frame.show(); frame.setSize(500, 500); frame.setVisible(false); Chart chart = createChart(frame); Image image = frame.createImage(500, 500); chart.paintChart(image.getGraphics()); RenderedOp im = JAI.create("AWTImage", image); JAI.create("filestore", im, "SampleJai.png", "PNG"); System.exit(0); } static Chart createChart(Component component) { Chart chart = new Chart(component); 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; } }