Legend

#This script hides all but Color by in legend, including color axis selector and title
from Spotfire.Dxp.Application.Visuals import BarChart
vis=vis.As[BarChart]()
for legendItem in v.Legend.Items: 
   legendItem.Visible=False
   if legendItem.Title == "Color by":
      legendItem.Visible=True
      legendItem.ShowTitle=False      
      legendItem.ShowAxisSelector=False



#This script shows or hides the description on all visualization legends.
#showHide is a boolean script param.
from Spotfire.Dxp.Application.Visuals import Visualization
for p in Document.Pages:
 for v in p.Visuals: 
  if not "HtmlTextArea" in str(v.TypeId):
   v = v.As[Visualization]()
   for legendItem in v.Legend.Items: 
    if legendItem.Title == "Description":legendItem.Visible=showHide

No comments: