using Imsl.Chart2D; using System; using System.Windows.Forms; public class LineEx1 : FrameChart { public LineEx1() { Chart chart = this.Chart; AxisXY axis = new AxisXY(chart); int npoints = 20; double dx = .5 * System.Math.PI / (npoints - 1); double[] x = new double[npoints]; double[] y1 = new double[npoints]; double[] y2 = new double[npoints]; double[] y3 = new double[npoints]; // Generate some data for (int i = 0; i < npoints; i++) { x[i] = i * dx; y1[i] = System.Math.Sin(x[i]); y2[i] = System.Math.Cos(x[i]); y3[i] = System.Math.Atan(x[i]); } Data d1 = new Data(axis, x, y1); Data d2 = new Data(axis, x, y2); Data d3 = new Data(axis, x, y3); // Set Data Type to Line axis.DataType = Imsl.Chart2D.AxisXY.DATA_TYPE_LINE; // Set Line Colors d1.LineColor = System.Drawing.Color.Red; d2.LineColor = System.Drawing.Color.Black; d3.LineColor = System.Drawing.Color.Blue; // Set Data Labels d1.SetTitle("Sine"); d2.SetTitle("Cosine"); d3.SetTitle("ArcTangent"); // Add a Legend Legend legend = chart.Legend; legend.SetTitle(new Text("Legend")); chart.AddLegendItem(1, chart); legend.IsVisible = true; // Set the Chart Title chart.ChartTitle.SetTitle("Line Plots"); } public static void Main(string[] argv) { System.Windows.Forms.Application.Run(new LineEx1()); } }