title: How To Toggle Lines & Curves Names Visibility On Spotfire With Iron Python?
body: <p>I've been trying to create an IronPython script to toggle my BarChart Horizontal Lines names with no luck.</p>
  
  <p>I would like to achieve this with a button click:
  <a href="https://i.stack.imgur.com/HaxDA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HaxDA.png" alt="enter image description here"></a></p>
  
  <p>The code I am currently using is: </p>
  
  <pre><code>from System.Drawing import Color
  from Spotfire.Dxp.Application.Visuals import *
  
  # vis parameter referencing an existing BarChart visualization
  vis = vis.As[BarChart]()
  
  # Read the document property with the toggle value (true/false)
  Document.Properties['GenericToggleLineNames'] = not Document.Properties['GenericToggleLineNames']
  
  #Loop through all the Lines &amp; Curves collection
  if Document.Properties['GenericToggleLineNames']:
      for fm in vis.FittingModels:
          if fm.Line.DisplayName == 'Defined Underload Limit':
              fm.Line.CustomDisplayName = 'Defined Underload Limit'
          elif fm.Line.DisplayName == 'Defined Warning Limit':
              fm.Line.CustomDisplayName = 'Defined Warning Limit'
          elif fm.Line.DisplayName == 'Defined Critical Limit':
              fm.Line.CustomDisplayName = 'Defined Critical Limit'
  else:
      for fm in vis.FittingModels:
          if fm.Line.DisplayName == 'Defined Underload Limit':
              fm.Line.CustomDisplayName = ''
          elif fm.Line.DisplayName == 'Defined Warning Limit':
              fm.Line.CustomDisplayName = ''
          elif fm.Line.DisplayName == 'Defined Critical Limit':
              fm.Line.CustomDisplayName = ''
  </code></pre>
  
  <p>But, when I get to the "Show = true", the code does not change the CustomDisplayNames. </p>
  
  <p>According to the Spotfire API, <a href="https://docs.tibco.com/pub/doc_remote/sfire-analyst/7.13.0/doc/api/html/4f1dae7b-c6cd-026c-a8a0-0ec0ea8049c2.htm" rel="nofollow noreferrer">DisplayName</a> only offers a <em>get</em> method, while 
  <a href="https://docs.tibco.com/pub/doc_remote/sfire-analyst/7.11.0/TIB_sfire-analyst_7.11.0_api/html/F_Spotfire_Dxp_Application_Visuals_FittingModels_ReferenceCurve_PropertyNames_CustomDisplayName.htm" rel="nofollow noreferrer">CustomDisplayName</a> offers both <em>get</em> and <em>set</em>.</p>
  
  <p>Does anyone know how to create this toggle?</p>