In a previous Tip of the Week, we introduced
you to Script Controls. Since that tip,
interest in Script Controls has grown exponentially. As a result, we are presenting another tip which
shows you the power of Script Controls to expose visualization properties to a
Business User. These tasks can be done
by a Business Analyst or Author inside TIBCO Spotfire Professional , but
if you want to expose these tasks to Business Users in the Web Player, this is
where Script Controls come in.
In the first example, we will create a Script
which will allow a Business User to toggle whether to 'Sort bars by
height'. Below is the script for this
task:
from Spotfire.Dxp.Application.Visuals
import BarChart
for vis in Application.Document.ActivePageReference.Visuals:
if
vis.Title == "Bar Chart":
if vis.As[BarChart]().SortedBars ==
True:
vis.As[BarChart]().SortedBars = False
else:
vis.As[BarChart]().SortedBars = True
In the next example, we will create a Script which will allow a Business
User to toggle a Bar Chart's Stack Mode from Stacked to 100% Stacked. Below is
the script for this task:
import
Spotfire.Dxp.Application.Visuals.StackMode as stackMode
from
Spotfire.Dxp.Application.Visuals import BarChart
for vis in Application.Document.ActivePageReference.Visuals:
if
vis.Title == "Bar Chart":
if vis.As[BarChart]().StackMode ==
stackMode.Stack:
vis.As[BarChart]().StackMode =
stackMode.Stack100Percent
else:
vis.As[BarChart]().StackMode
= stackMode.Stack
If you are interested in learning more about Script Controls, we just launched our full day course SP232 - TIBCO Spotfire Automation APIs using IronPython. This course covers how to create Script Controls, introduces you to syntax and semantics of the IronPython language, and also walks you through the Spotfire Automation (Client) APIs. View details about the course and schedule at the following link.
http://inter.viewcentral.com/reg/TIBCO/scriptcontrols
Also, we are launching a new feature of the Community: a poll, which will serve to help us gather information in order to improve the Community, our product, our training, etc... Please check it out. New polls will most likely be created every couple weeks or monthly.