I've been trying to create an IronPython script to toggle my BarChart Horizontal Lines names with no luck.

I would like to achieve this with a button click:
[![enter image description here](https://i.stack.imgur.com/HaxDA.png)](https://i.stack.imgur.com/HaxDA.png)

The code I am currently using is: 

```
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 & 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 = ''

```

But, when I get to the "Show = true", the code does not change the CustomDisplayNames. 

According to the Spotfire API, [DisplayName](https://docs.tibco.com/pub/doc_remote/sfire-analyst/7.13.0/doc/api/html/4f1dae7b-c6cd-026c-a8a0-0ec0ea8049c2.htm) only offers a *get* method, while 
[CustomDisplayName](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) offers both *get* and *set*.

Does anyone know how to create this toggle?