The IMSL C# Numerical Library chart package is designed to allow the creation of highly customizable charts using any .NET language. An IMSL C# Numerical Library chart is created by assembling ChartNodes into a tree. This chart tree is then rendered to the screen or printer.

The following class is a simple example of the use of the IMSL C# Numerical Library chart package. The chart is displayed in a Windows.Forms.Form. The code to create the chart is all in the constructor. The IMSL C# Numerical Library class FrameChart extends the .NET class Form and creates a Chart object.



(Download Code)


using Imsl.Chart2D;


public class Intro1 : FrameChart {


    public Intro1() {

        Chart chart = this.Chart;

        AxisXY axis = new AxisXY(chart);

        double[] y = new double[] {4, 2, 3, 9};

        new Data(axis, y);



    public static void Main(string[] argv) {

        System.Windows.Forms.Application.Run(new Intro1());




The above example created and assembled three nodes into the following tree. The root Chart node is created by the FrameChart class.



The general pattern of the ChartNode class, and classes derived from it, is to have constructors whose first argument is the parent ChartNode of the ChartNode being created. 

The root node of the tree is always a Chart object. It is usually constructed within FrameChart or PanelChart, which handles the repainting of the chart within Windows Forms. If a Chart object is explicitly created, and used within a Windows form, then its Paint(Graphics) method must be called from the container's Paint(Graphics) method.

Chart nodes can contain attributes, such as FillColor and LineWidth. Attributes are inherited via the chart tree. For example, when a Data node is being painted, its LineWidth attribute determines the thickness of the line. If this attribute is set in the data node being drawn, that is the value used. If it is not set, then its parent node (an AxisXY node in the above example) is queried. If it is not set there, then its parent is queried. This continues until the root node is reached after which a default value is used. Note that this inheritance is not the same as C# class inheritance.

Attributes are set using axis.LineWidth = value or SetViewport(double[]) and retrieved using axis.LineWidth or GetViewport().

Visual Numerics - Developers of IMSL and PV-WAVE
PHONE: 713.784.3131