Adding a Chart to an Application

For simplicity, most of the examples in this manual use the FrameChart class.   FrameChart is useful for quickly building an application that is a chart. The class PanelChart is used to build a chart into a larger application. It extends .NET’s Windows.Forms.Panel class and can be used wherever a Panel can be used. The following code shows a PanelChart being created, added to a Form, which contains the Chart hierarchy. The generated chart is the same as the first one on this page and so is not shown here.

SamplePanel.png

(Download Code)

 

using Imsl.Chart2D;

 

public class SamplePanel : System.Windows.Forms.Form

{

    private PanelChart panelChart;

 

    public SamplePanel()

    {

        panelChart = new PanelChart();

        panelChart.Dock = System.Windows.Forms.DockStyle.Fill;

        this.Controls.Add(panelChart);

 

        Chart chart = panelChart.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 SamplePanel());

    }

}



Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260