Labels

These IronPython scripts below show how to modify any of the Bar Chart visualization settings found on the Labels tab of the Bar 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 Bar 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 labels for all, marked rows, or none
  2. Use horizontal or vertical label orientation
  3. Show (or hide) labels for the complete bar
  4. Show (or hide) labels for bar segments
  5. Show bar segment labels as percentage or value
  6. Set the “Max number of labels on complete bars”
  7. Set the “Bar percentage decimals”
from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

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

# 2. Use horizontal or vertical label orientation
myVis.LabelOrientation = LabelOrientation.Horizontal
# OR
myVis.LabelOrientation = LabelOrientation.Vertical

# 3. Show (or hide) labels for the complete bar
myVis.LabelCompleteBar = True

# 4. Show (or hide) labels for bar segments
myVis.LabelSegments = True

# 5. Show bar segment labels as percentage or value
myVis.SegmentLabelInformationType = LabelInformationType.Percentage
# OR
myVis.SegmentLabelInformationType = LabelInformationType.Value

# 6. Set the "Max number of labels on complete bars" 
myVis.MaxNumberOfLabels = 50  #Any integer from 0 to 200 is allowed

# 7. Set the "Bar percentage decimals" 
myVis.LabelPercentageDecimalDigits = 3  #Any integer from 0 to 6 is allowed
Welcome!

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

If you have any questions, comments, or ideas, feel free to get in touch!