-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangeFonts.py
More file actions
34 lines (28 loc) · 1.3 KB
/
Copy pathChangeFonts.py
File metadata and controls
34 lines (28 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Neil Kanungo
# TIBCO Software
# January 2023
# Set the font size and style to all visualizations on the active page
from Spotfire.Dxp.Application.Visuals import VisualContent, VisualTypeIdentifiers
from System.Drawing import *
font = Font("Roboto",7) # Set your desired font style and size here
# Get the active page
page = Application.Document.ActivePageReference
# Iterate through all visualizations on the page
for vis in page.Visuals:
# Get the visual content object
visContent = vis.As[VisualContent]()
# Change fonts for core plots
if vis.TypeId in [VisualTypeIdentifiers.BarChart, VisualTypeIdentifiers.ScatterPlot, VisualTypeIdentifiers.LineChart, VisualTypeIdentifiers.CombinationChart, VisualTypeIdentifiers.HeatMap, VisualTypeIdentifiers.ParallelCoordinatePlot]:
visContent.LabelFont = font
visContent.XAxis.Scale.Font = font
visContent.YAxis.Scale.Font = font
visContent.Legend.Font = font
# Change fonts for Pie chart
if vis.TypeId in [VisualTypeIdentifiers.PieChart]:
visContent.VisualAttributes.LabelFont = font
visContent.Legend.Font = font
# Change fonts for Tables
if vis.TypeId in [VisualTypeIdentifiers.Table, VisualTypeIdentifiers.SummaryTable]:
visContent.TableFont = font
visContent.TableHeaderFont = font
visContent.Legend.Font = font