Maximize and Restore a Visualization Layout

Maximize Visualization:
#Maximizes the given (vis script parameter) Visualization
from Spotfire.Dxp.Application import Layout
Document.ActivePageReference.ActiveVisualReference = vis

Restore visualization:
#to restore your handcrafted visualization layout, create a special bookmark selecting only the *Page Layout and Visualization* option. You can either create an Action Control to apply the bookmark or apply the bookmark programatically:
from  Spotfire.Dxp.Application.AnalyticItems import BookmarkManager
from Spotfire.Dxp.Application import BookmarkComponentFlags  

#search bookmarks (assuming that bookmark 'Restore' exists)
bookmarkManager = Application.Document.Context.GetService(BookmarkManager)
myBookmark = bookmarkManager.Search('name::"Restore"')[0]

#apply a bookmark
components = BookmarkComponentFlags.PageConfiguration | BookmarkComponentFlags.FilterOrganization
bookmarkManager.Apply(myBookmark, components)


Jolene said...

Hi, is there any way to have more control over the layout when you maximize it? For example, I have 6 plots, a text area along the top that I use as a banner, and a text area along the side that I use as a customized filter panel. When I maximize the specified vis, it goes ontop of everything and squishes everything down to the bottom. I have to resize the layout manually to get to the 'restore' button. Any ideas? Thanks!

Jose Leviaguirre said...

Hello Jolene,

Thanks for your comment. I would create a bookmark for each particular visualization you want to 'maximize' by keeping the banner on top. Banner will include buttons for bookmark calls for each 'maximized' visualization, including your 'restored' (or default) version of it. Make sure your bookmarks only keep the page visualization layout. I am not sure if you even need scripting for it.