Jump to content

How can one use one IronPython script to set the same Y axis range on all common visualizations (bar charts and combination charts) on one page

Thomas Hren

Recommended Posts

I have an ironpythonscript that sets the Y axis range for one visualization on a page. However, I have several visualizations on the same page that need to have their Y axis set to the same axis range. The Y axis range in the script is set by two defined Document Properties: "YAxisMax" and "YAxisMin". My script so far is as follows:

from Spotfire.Dxp.Application.Visuals import VisualContent

from Spotfire.Dxp.Application.Visuals import AxisRange

#To set the axis range:

viz= viz1.As[VisualContent]()

viz.YAxis.Range = AxisRange(Document.Properties["YAxisMin"],Document.Properties["YAxisMax"])

I found the following ironpythonscript snippet to loop through all the visualizations on the active page:

#On this page, loop through every visual

for visual in Document.ActivePageReference.Visuals:

However, I do not know how to set use this snippet within the Script above to set all the visualizations on the same page. Any help would be greatly appreciated.

Spotfire Desktop version 10.10.1 LTS

Link to comment
Share on other sites

  • 2 weeks later...

Hi thren,

I have found this code snippet, that cycles through pages and visuals. Maybe you could insert the range code after this initial code (replacing the print parts that is)

# Copyright 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license. #Writing output to a Document Property that could be shown in a html/text area in Spotfire Document.Properties["scriptOutput"]='' #loop through all pages and visualizations, and print the Type of each visualization for p in Document.Pages: print (p.Title) Document.Properties["scriptOutput"]+=p.Title+'n' for v in p.Visuals: print ('-' + v.Title + '('+ v.TypeId.Name +')') Document.Properties["scriptOutput"]+='-'+v.Title+'('+v.TypeId.Name+')n'


Otherwise, this is the'quick and dirty option, you could just enter all the individual visualizations and change them according to your document properties.

Kind regards,


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...