Jump to content
  • Remove All Columns in a Graphical Table, add a Sparkline Column and an Icon Column in Spotfire® Using IronPython Scripting


    This an example on how to remove all columns in a Graphical Table, and then adding a basic Sparkline Column and a basic Icon Column.

    Introduction

    This an example on how to remove all columns in a Graphical Table, and then adding a basic Sparkline Column and a basic Icon Column.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Application.Visuals import *
    from Spotfire.Dxp.Application.Visuals.Miniatures import *
    
    from System.Drawing import Color
    
    for vis in Document.ActivePageReference.Visuals:  
        if vis.TypeId == VisualTypeIdentifiers.GraphicalTable:
    
            #define Script Parameter
            viz = vis.As[GraphicalTable]()
            viz.Title = 'Sales'
            viz.Legend.Visible = False
            viz.HeaderColumnWidth =100
    #        viz.RowAxis.Expression ='<[Product]>'
    ######################################################
    # Remove all columns:
            for c in viz.Columns:
                viz.Columns.Remove(c)
    ######################################################
    # Add Sparkline Column
            (status,NewColumn) = viz.Columns.AddNew[SparklineMiniatureVisualization]()
            NewColumn.AutoConfigure()
            NewColumn.Title = 'Internet Subscribers'
            NewColumn.YAxis.Expression = "Avg([Internet Subscribers])"
    ######################################################
    # Add Icon Column
            (status,NewColumn) = viz.Columns.AddNew[IconMiniatureVisualization]()
            NewColumn.AutoConfigure()
            NewColumn.Title = 'Top'
            NewColumn.IconAxis.Rules.AddTopNRule(5, Color.FromName("Red"), MarkerShape(MarkerType.StarFour))
    ######################################################
    
    # Column Types:
    # BulletGraphMiniatureVisualization
    # CalculatedValueMiniatureVisualization
    # IconMiniatureVisualization
    # SparklineMiniatureVisualization
     

     

    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...