Code example explaining how to set up box plots.
Refer to What is a Box Plot? for a box plot presentation.
Create and Configure a Box Plot
public static void CreateBoxPlot(AnalysisApplication application)
{
// Add a box plot to the page
BoxPlot boxPlot = application.Document.ActivePageReference.Visuals.AddNew<BoxPlot>();
boxPlot.Title = "Basic Box Plot";
// Connect the box plot to data
DataManager dataManager = application.Document.Data;
boxPlot.Data.DataTableReference = dataManager.Tables.DefaultTableReference;
// Set filtering for the visualization
boxPlot.Data.UseActiveFiltering = true;
// Set marking for the visualization
boxPlot.Data.MarkingReference = dataManager.Markings.DefaultMarkingReference;
// Set up the x-axis
boxPlot.XAxis.Expression = "<Type>";
boxPlot.YAxis.Expression = "Sales";
// Set up the statistics table
boxPlot.Table.Measures.AddRange(new string[]
{
"Count",
"Median",
"Outliers",
"Q1",
"Q3"
});
// Turn on Tukey-Kramer comparison circles
boxPlot.ComparisonCircles.AlphaLevel = 0.1;
boxPlot.ComparisonCircles.Visible = true;
}