Skip to main content
RSS feed Subscribe to feed


Virtual Columns: Adding

This example shows how to add a virtual column to a table, and set the input for it. It also shows how add virtual columns are added to a table, setting column properties, in this case a renderer.

public void AddVirtualColumnProducer(TablePlotBase plot)
        // Turn off the auto add feature so that new virtual
        // columns will not automatically be added to the plot.
        plot.AutoAddNewColumns = false;

        // Create a producer from a type id and add it to the 
        // virtual column producers collection.
        // The producer will be configured to contain certain columns
        // via ConfigureColumnsCore
        VirtualColumnProducer producer = plot.VirtualColumnProducers.AddNew(

        // Get a column from the data table used in the plot.
        DataColumn dataColumn = plot.Data.DataTableReference.Columns[0];

        // Set the one data column to be the input for the
        // new producer.
        MyVirtualColumnProducer myProducer = (MyVirtualColumnProducer)producer;
        myProducer.SelectedInput = new DataColumnSignature(dataColumn);

        // Add the virtual columns from the producer to the plot, and
        // set the renderer to bitmap renderer. Note that the columns
        // would already be in the plot if the AutoAdddNewColumns bool
        // was set to true.
        foreach (VirtualColumn virtualColumn in producer.Columns)