Inserting Visualizations

The syntax below can be used to add a new visual to a page. This is equivalent to clicking on one of the visualization icons in the Visualizations Toolbar at the top right of the Spotfire workspace or clicking Insert -> Visualization -> [Chart Type] in the main toolbar.

from Spotfire.Dxp.Application.Visuals import BarChart
myVis = Document.ActivePageReference.Visuals.AddNew[BarChart]()

#The myVis variable now references the newly created visual
myVis.Title = 'New Bar Chart'

Inserting Other Visualization Types

This code pattern can be used to insert almost any visualization type into a page (for Map Charts and Graphical Tables, see the last sections below). Simply replace BarChart in the script above (first and second line) with any of the visualization classes shown below.

  • BarChart
  • BoxPlot
  • CombinationChart
  • CrossTablePlot
  • HeatMap
  • HtmlTextArea (for Text Areas)
  • KpiChart (available Spotfire 7.8 and up)
  • LineChart
  • ParallelCoordinatePlot
  • PieChart
  • ScatterPlot
  • ScatterPlot3D
  • SummaryTable
  • TablePlot (for Tables)
  • Treemap
  • WaterfallChart

Adding Map Charts and Graphical Tables require a slightly different syntax, as shown below.

Inserting a Map Chart

from Spotfire.Dxp.Application.Visuals import Maps
myVis = Document.ActivePageReference.Visuals.AddNew[Maps.MapChart]()

Inserting a Graphical Table

from Spotfire.Dxp.Application.Visuals.Miniatures import GraphicalTable
myVis = Document.ActivePageReference.Visuals.AddNew[GraphicalTable]()
Welcome!

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