Creating a Trellis Chart

Below is an example of creating a trellis chart using the C# language.

To execute the example, add links to the .NET Framework libraries:

And also connect platform libraries:

Executing the example requires implementing the TrellisDataSupplier class that is a data source for trellis chart.

static void Main(string[] args)
{
    // Create a new form
    Form f = new Form();
    f.Width = 1024;
    f.Height = 768;
    f.Shown += f_Shown;
    Application.EnableVisualStyles();
    Application.Run(f);
}
static void f_Shown(object sender, EventArgs e)
{
    // Create and set up a new trellis chart
    Form parent = sender as Form;
    ITrellisChart trellisChart = new TrellisChart();
    TrellisDataSupplier dataSup = new TrellisDataSupplier();
    trellisChart.DataSupplier = dataSup;
    var ppr = new GxRect();
    ppr.Left = 0;
    ppr.Right = 2;
    ppr.Top = 0;
    ppr.Bottom = 1;
    trellisChart.ViewFrame = ppr;
    var r = parent.ClientRectangle;
    ppr.Left = r.Left;
    ppr.Width = (int)(r.Width * 0.9);
    ppr.Top = r.Top;
    ppr.Height = (int)(r.Height * 0.95);
    trellisChart.CreateWnd(parent.Handle, ppr, 1.0);
    // Set type of child charts in trellis chart
    trellisChart.ChartSettings.Type = ChartType.chtMultiple;
}

A form is created on starting the example. The form dialog box contains a trellis chart where several child charts are located.

Creating a Data Source for Trellis Chart

To create a data source, use the TrellisDataSupplier class. Below is the example of implementing this class.

Code of the TrellisDataSupplier class

See also:

ITrellisChart