Toggle Straight Fit Line with Labels using Iron Python

Hello all!

I am trying to write a script to toggle a "Straight Line Fit" curve and display the R^2 value on a scatter plot.  I am to the point where i am displaying the line, but I am not sure what to add to get the label to show up and to be able to toggle between visible/not visible. 

Here is what I have so far:

from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Application.Visuals.FittingModels import *
from Spotfire.Dxp.Application.Extension import *

for visual in Document.ActivePageReference.Visuals:
 if visual.TypeId == VisualTypeIdentifiers.ScatterPlot:
  sp = visual.As[ScatterPlot]()
  sp.FittingModels.Clear()
  state = sp.FittingModels.AddNew(StraightLineFittingModel)

(1) Answer

Login