Toggling Labels in LineChart using Python script: nothing sets apart from 0(None)


Currently I'm trying to toggle data labels (Show/Hide) on a linechart. For that I created a Document Property with "Yes", "No" string values. I can hide the labels using code, but python throws an error when setting up lineChart.LabelVisibility  property to anything apart from 0. Can anybody please help/suggest a workaround?

Here's the code I'm using:

from Spotfire.Dxp.Application.Visuals import *
visuals = Document.ActivePageReference.Visuals
varProp =Document.Properties["dcTrendLabelToggle"]

for vis in visuals:
    if vis == varViz:
        lineChart = vis.As[LineChart]()
        #print lineChart.LabelVisibility
        if varProp == "No":
            lineChart.LabelVisibility =0     #This part works & hides the labels.
        if varProp == "Yes":
            lineChart.LabelVisibility =2    #TypeError: Cannot convert numeric value 2 to LabelVisibility.  The value must be zero


Any help would be highly appreciated.






(1) Answer