Jump to content
  • How to toggle a visualization in Spotfire® Using IronPython Scripting


    There is no out of box functionality to toggle a visualization. We can use the below IronPython code to add or remove the visualization on a button click

    Introduction

    There is no out of box functionality to toggle a visualization. We can use the below IronPython code to add or remove the visualization on a button click 

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    from Spotfire.Dxp.Application.Visuals import *
    
    page=Document.ActivePageReference
    vizExists=False
    for visual in page.Visuals:
    	if visual.Title=="cTable":
    		vizExists=True
    if vizExists:
    	page.Visuals.Remove(visual)
    else:
    	visual=page.Visuals.AddNew(VisualTypeIdentifiers.CrossTable)
    	visualB=visual.As[CrossTablePlot]()
    	visualB.Title="cTable"
    # add a script parameter table referring to the Data Table required
    	visualB.Data.DataTableReference=table
    	visualB.ColumnAxis.Expression="<[Country]>"
    	visualB.RowAxis.Expression="<[Manager]>"
    	visualB.MeasureAxis.Expression="Sum([Spent])"
     

    References

    License:  TIBCO BSD-Style License

     

    Back to IronPyton Scripting in Spotfire Examples:  https://community.spotfire.com/s/article/IronPython-Scripting-in-Spotfire


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...