Axis Expression Property TIBCO Spotfire 6.5 API Reference
Gets or sets the expression that defines how data is mapped to this axis.

Namespace: Spotfire.Dxp.Application.Visuals
Assembly: Spotfire.Dxp.Application (in Spotfire.Dxp.Application.dll) Version: 14.10.7525.5058 (14.10.7525.5058)
Syntax

public string Expression { get; set; }

Property Value

Type: String
The expression.
Exceptions

ExceptionCondition
System ArgumentNullExceptionIf set to null.
System ArgumentException If a continuous expression is set on an axis that can only be categorical.
-or-
If a categorical expression is set on an axis that can only be continuous.
-or-
If set to an invalid categorical expression.
Spotfire.Dxp.Data.Exceptions ExpressionParseExceptionIf set to an expression that could not be parsed.
Remarks

Expressions are either continuous or categorical. Categorical expressions are embraced by angle brackets: The expression X is continuous, whereas the expression <X> is categorical.

In its simplest form an expression is simply a column name, such as Sales. In aggregated visualization this is often combined with an aggregation method, as in Sum(Sales).

An axis may support categorical expressions, continuous expressions, or both. This depends on the axis in question. The Y axis of a scatter plot, for instance, can be either continuous or categorical, but the Y axis of a bar chart only supports continuous expressions.

When building expressions programmatically, identifiers such as column names should be escaped. This is to ensure that special characters such as square brackets and spaces are treated correctly. This can be done using the ExpressionUtilities class, or by using the NameEscapedForExpression property of DataColumn.

Examples

The following sample demonstrates how to set the Expression property on axes in a bar chart.
public void CreateBarchart(AnalysisApplication application)
{
    // Create the bar chart
    BarChart barChart = application.Document.ActivePageReference.Visuals.AddNew<BarChart>();

    // Connect the bar chart to data
    DataManager dataManager = application.Document.Data;
    barChart.Data.DataTableReference = dataManager.Tables.DefaultTableReference;

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

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

    // Put the column named Year on the x-axis. Put angles around it to make it categorical.
    barChart.XAxis.Expression = "<Year>";

    // Put sum of column sales on the y-axis. This is a continuous expression.
    barChart.YAxis.Expression = "Sum(Sales)";

    // And finally color categorically by the column named Region
    barChart.ColorAxis.Expression = "<Region>";
}
Version Information

Supported in: 6.5, 6.0, 5.5, 5.0, 4.5
See Also