Jump to content
  • IronPython script to Toggle Map Label Visibility


    This script to control labels on specific layers in a map chart

    Introduction

    Use this script to control labels on specific layers in a map chart. This includes being able to toggle labels on, off, or set to just marked rows.

    Code Sample

    # Copyright © 2019. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    # Author - Neil Kanungo & Sayali Patil, TIBCO Software, April 2019
    
    from Spotfire.Dxp.Application.Visuals import * 
    from Spotfire.Dxp.Application.Visuals.Maps import * 
    
    vis = vis.As[VisualContent]() #set 'vis' as a MapChart visualization script paramater
    
    for i in vis.Layers: 
     if i.Title == "YourLayerNameHere": #enter your layer name
      if i.Visualization.LabelVisibility == LabelVisibility.None:
       i.Visualization.LabelVisibility = LabelVisibility.All
      else:
       i.Visualization.LabelVisibility = LabelVisibility.None
    
    # To set label visibilty to marked rows only, use the following inside the if-else statement
    # i.Visualization.LabelVisibility = LabelVisibility.Marked
     

    Example

    toggle_labels.thumb.gif.27c65d8e589b31326450a74cbe23acd0.gif

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...