Labels

These IronPython scripts below show how to modify any of the Pie Chart visualization settings found on the Labels 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 Labels Tab Options:

This IronPython script shows how to change the following, in order from top to bottom in the user interface:

  1. Show sector percentage, sector value, and/or sector category in labels
  2. Show labels for all, marked rows, or none
  3. Set max number of labels
  4. Set sector percentage threshold
  5. Set sector percentage decimals
  6. Set label position to inside or outside pie
from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

# 1. Show sector percentage, sector value, and/or sector category in labels
myVis.VisualAttributes.LabelPercentage = True  #Show sector percentage
# AND/OR
myVis.VisualAttributes.LabelValue = True  #Show sector value
# AND/OR
myVis.VisualAttributes.LabelCategory = True  #Show sector category

# 2. Show labels for all, marked rows, or none
myVis.VisualAttributes.LabelVisibility = LabelVisibility.All
# OR
myVis.VisualAttributes.LabelVisibility = LabelVisibility.Marked
# OR
myVis.VisualAttributes.LabelVisibility = LabelVisibility.None

# 3. Set max number of labels
myVis.VisualAttributes.MaxNumberOfLabels = 50  #Integers from 0 to 200 allowed

# 4. Set sector percentage threshold
myVis.VisualAttributes.LabelPercentageLimit = 15  #Integers from 0 to 100 allowed

# 5. Set sector percentage decimals
myVis.VisualAttributes.LabelPercentageDecimalDigits = 4  #Integers from 0 to 6 allowed

# 6. Set label position to inside or outside pie
myVis.VisualAttributes.LabelPosition = LabelPosition.Inside
# OR
myVis.VisualAttributes.LabelPosition = LabelPosition.Outside
Welcome!

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