The requirement is to show or hide visualizations (charts) in the spotfire report based on the button click. At present there is not APIs that we can leverage to achieve this functionality. Raising this idea to consider including this API for future releases of Spotfire.
I started such a script (below) that doesn't hide but removes confidential visuals. I got caught up in re-adding visuals part. I suspect it could be done through bookmarks or undo functions. Also, in this example, since charts are removed, it resizes all the other visuals which makes for an ugly export :(
This would be useful when printing a page with "confidential" information. A print script could be written that hides confidential charts, prints, then un-hides those charts
I need this as well.