Fonts

These IronPython scripts below show how to modify any of the Line Chart visualization settings found on the Fonts tab of the Line 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 Line 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)

# X-axis scale labels:
myVis.XAxis.Scale.Font = font

# Y-axis scale labels:
myVis.YAxis.Scale.Font = font

# X-axis title label (printing only):
myVis.XAxis.TitleFont = font

# Y-axis title label (printing only):
myVis.YAxis.TitleFont = font

# Labels:
myVis.LabelFont = font

# Trellis headers:
myVis.Trellis.HeaderFont = font

# Legend:
myVis.Legend.Font = font

# Line & curve labels:
myVis.FittingModels.LabelFont = 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.