using Imsl.Chart2D; using System.Drawing; using System.IO; public class SampleBoxPlot : FrameChart { private double[][] irisData; private string[] labels; public SampleBoxPlot() { ReadData("FisherIris.csv"); Chart chart = this.Chart; AxisXY axis = new AxisXY(chart); BoxPlot boxPlot = new BoxPlot(axis, irisData); boxPlot.BoxPlotType = BoxPlot.BOXPLOT_TYPE_HORIZONTAL; boxPlot.SetLabels(labels); boxPlot.Bodies.FillColor = Color.Green; boxPlot.MarkerType = BoxPlot.MARKER_TYPE_FILLED_CIRCLE; boxPlot.OutsideMarkers.MarkerColor = Color.Blue; boxPlot.FarMarkers.MarkerColor = Color.Red; boxPlot.Notch = true; } public static void Main(string[] argv) { System.Windows.Forms.Application.Run(new SampleBoxPlot()); } private void ReadData(string fileName) { int nColumns = 5; int nObs = 150; irisData = new double[nColumns][]; for (int i = 0; i < nColumns; i++) irisData[i] = new double[nObs]; string line; string[] tokens; int lineCount = 0; StreamReader sr = new StreamReader(fileName); line = sr.ReadLine(); labels = line.Split(','); for (int i = 0; i < nObs; i++) { line = sr.ReadLine(); tokens = line.Split(','); for (int j = 0; j < nColumns; j++) { irisData[j][lineCount] = double.Parse(tokens[j].Trim()); } lineCount++; } } }