Size

These IronPython scripts below show how to modify any of the Pie Chart visualization settings found on the Size tab of the Pie Chart Properties dialog box in the Spotfire user interface.
Note

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 Pie Chart Size Tab Options:

  1. Change the “Sector size by” custom expression
  2. Set the pie size (move the slider)
  3. Change the “Sector size by” custom expression
  4. Set the pie size scale min and max limit
from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

# 1. Change the "Sector size by" custom expression
myVis.SectorSizeAxis.Expression = "Sum([Column 1])"

# 2. Set the pie size (move the slider)
myVis.MarkerSize = 5  #Valid range is 0 to 100
# From the Spotfire API Docs:
# The size is expressed in percent of the height or width of the plot. 
# A value of 100 means that a marker will occupy the full height or 
# width of the plot (whichever is smallest).

# 3. Change the "Sector size by" custom expression
myVis.SizeAxis.Expression = "Sum([Column 2])"

# 4. Set the pie size scale min and max limit
# Enter as AxisRange([minimum], [maximum]) to set the range
myVis.SizeAxis.Range = AxisRange(-50, 250)
# OR
# Enter None keyword to set either end of the range back to "Automatic"
myVis.SizeAxis.Range = AxisRange(None, None)
Note

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.

Welcome!

The purpose of this website is to provide a comprehensive, accurate, and efficient IronPython reference for Spotfire developers.