Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Working with Lines & Curves in Spotfire® Using IronPython Scripting


    Introduction

    This sample article demonstrates how to use Lines & Curves via IronPython scripting

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from System.Drawing import Color
    from Spotfire.Dxp.Application.Visuals import *
    
    #Add a vis parameter referencing an existing LineChart visualization
    vis = vis.As[LineChart]()
    
    #Clear all Lines & Curves for a visualization
    vis.FittingModels.Clear()
    
    #Loop through all the Lines & Curves collection
    for fm in vis.FittingModels:
     #To remove a specific line or curve
     if fm.Line.DisplayName == 'Avg(Y)':
      vis.FittingModels.Remove(fm)
    
    #Adding AddHorizontalLine
    horizontal_line=vis.FittingModels.AddHorizontalLine("Avg([Y])")
    horizontal_line.Line.Visible=True
    labels_tooltips=horizontal_line.Line.Details
    #Loop through all the labels and tooltips and enable/disable them
    for lt in de:
     print lt.Name,lt.DisplayName,lt.ShowInLabel,lt.ShowInTooltip
     lt.ShowInLabel=True
    
    
    #Adding AddStraightLineFit
    straightfit_line=vis.FittingModels.AddStraightLineFit()
    straightfit_line.Line.CustomDisplayName="My_Str_Line"
    straightfit_line.Line.Color=Color.Brown
    
    
    #Adding curve
    c=vis.FittingModels.AddCurve("Avg(10)")
    c.Curve.Visible=True
    c.Curve.Color=Color.Green
     

    References

    License:   TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...