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
Application.Document.ActivePageReference.ApplyLayout(Layout.TileMode.Maximize)

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)

Previous
Next Post »