In each of the scripts below, it is assumed that the MyVis variable references the targeted visualization. See here for more information about referencing visualizations.
Change Cross Table Horizontal Axis, Vertical Axis, or Cell Value Expressions
The IronPython script below updates the custom expressions used in the Horizontal, Vertical, or Cell Values input boxes.
from Spotfire.Dxp.Application.Visuals import * myVis = myVis.As[Visualization]() # Horizontal: myVis.ColumnAxis.Expression = "<[Column 1]>" # Vertical: myVis.RowAxis.Expression = "<[Column 2] NEST [Column 3]>" # Cell values: myVis.MeasureAxis.Expression = "Sum([Actual]), Sum([Forecast])"
If you aren't sure how to write a specific custom expression correctly from scratch, start by building the expression interactively using the Spotfire user interface. Once your custom expression is working correctly, right-click on the custom expression input box selector(s) and choose Custom Expression. You can then copy the expression shown into your IronPython script.
The purpose of this website is to provide a comprehensive, accurate, and efficient IronPython reference for Spotfire developers.