import com.imsl.chart.*; import java.io.*; import java.awt.*; public class SampleSVG { public static void main(String argv[]) throws java.io.IOException { Frame frame = new Frame(); frame.show(); frame.setSize(500, 500); frame.setVisible(false); Chart chart = createChart(frame); OutputStream os = new FileOutputStream("SampleSVG.svg"); Writer writer = new OutputStreamWriter(os, "UTF-8"); chart.writeSVG(writer, true); 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; } }