Skip to main content
RSS feed Subscribe to feed

 

Creating a Table

Code example explaining how to set up tables.

Refer to What is a Table? for a table presentation.

Create and Configure a Table Plot

public static void CreateTable(AnalysisApplication application)
{
    // Add a table to the page
    TablePlot tablePlot = application.Document.ActivePageReference.Visuals.AddNew<TablePlot>();
    tablePlot.Title = "Basic Table";

    // Connect the table to data
    DataManager dataManager = application.Document.Data;
    tablePlot.Data.DataTableReference = dataManager.Tables.DefaultTableReference;

    // Set filtering for the visualization
    tablePlot.Data.UseActiveFiltering = true;

    // Set marking for the visualization
    tablePlot.Data.MarkingReference = dataManager.Markings.DefaultMarkingReference;

    // Add columns to the table
    tablePlot.Columns.AddRange(new string[]
    {
        "Sales",
        "Cost",
        "Category",
        "Type"
    });

    // Sort by Cost
    tablePlot.SortedColumns.Add("Cost");

    // Set the row height
    tablePlot.RowHeight = 2;
}