Jump to content
  • How to toggle (Show/Hide) curves created in a visualization via Lines and Curves in Spotfire® using IronPython Scripting


    This article shows how to toggle (Show/Hide) curves created in a visualization via Lines and Curves in Spotfire® using IronPython Scripting

    Introduction

    This example shows ability to toggle (Show/Hide) curves created via Lines and Curves in a visualization (Line Chart in this case) using an IronPython script.

    Code sample

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import *
    
    for visual in Document.ActivePageReference.Visuals:
        if visual.TypeId == VisualTypeIdentifiers.LineChart:
            lc = visual.As[LineChart]()
        
    for fm in lc.FittingModels:
        if fm.TypeId.DisplayName == "Straight Line Fit":        
            if fm.Line.DisplayName == "Straight line":
                fm.Enabled=not(fm.Enabled)
        elif fm.TypeId.DisplayName == "Exponential Curve Fit":
            print fm.Curve.DisplayName
            if fm.Curve.DisplayName == "Exponential curve":            
                fm.Enabled=not(fm.Enabled)
     

    The other line types would include Polynomial Curve, Logarithmic Curve, Gaussian curve, etc.

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...