Fonts

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

Changing visualization fonts settings using IronPython requires two steps, as shown in the script below.

  1. Set up the desired font with font name, size, and style options
  2. Apply the font settings to any desired text categories
from Spotfire.Dxp.Application.Visuals import *
from System.Drawing import * 

myVis = myVis.As[Visualization]()

# 1. Set up the desired font:
# Font can be any font name in the "Font:" dropdown menu
# Size can be any integer in the "Size:" dropdown menu
# Style can be bold, italic, both, or neither
# Three possible examples are shown below:

# Arial, Size 20, Not Bold or Italic
font = Font("Arial", 20) 
# OR
# Calibri, Size 12, Bold
font = Font("Calibri", 12, FontStyle.Bold)
# OR
# Forte, Size 8, Bold and Italic
font = Font("Forte", 8, FontStyle.Bold | FontStyle.Italic)



# 2. Apply the font settings to any desired text categories
# (Order below is the same as the fonts tab in the user interface)

# Labels:
myVis.VisualAttributes.LabelFont = font

# Trellis headers:
myVis.Trellis.HeaderFont = font

# Legend:
myVis.Legend.Font = font

# Description:
# Not available in the Spotfire API

# Details visualization message:
myVis.Data.LimitingMarkingsEmptyMessageFont = font
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!