Jump to content
  • How to add a Line From Column Values to a Visualization in Spotfire® Using IronPython Scripting


    This article provides a sample script on how to add a "Line from column values"  fitting model to a visualization

    Introduction

    This article provides a sample script on how to add a "Line from column values"  fitting model to a visualization

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Application.Visuals.FittingModels import *
    #get the data table
    table=Document.Data.Tables["myDataTable"]
    # define vis as script parameter referring to your visualization 
    lchart=vis.As[ScatterPlot]()
    # Add a ColumnValuesLine fitting model
    fModel=lchart.FittingModels.AddNew(ColumnValuesLine)
    #Define the model
    fModel.DataTableReference=table
    fModel.XColumnReference=table.Columns["columnA"]
    fModel.YColumnReference=table.Columns["columnB"]
    
    #get the ReferenceCurve
    line=fModel.Line
    #set a custom name to the line
    line.CustomDisplayName="myLine"
    line.IsBackground=True
    line.LineStyle=LineStyle.Dot
     

     

    References

    License:  TIBCO BSD-Style License

    Back to IronPython Scripting in Spotfire® Examples


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...