Jump to content
  • How to Add/Edit Color Rule for a Calculated Value column in Graphical Table in Spotfire® Using IronPython Scripting


    This article explains how to Add/Edit Color Rule for a Calculated Value column in Graphical Table in Spotfire® Using IronPython Scripting

    Introduction

    This article describes how to:

    1. Add Calculated Value Column.
    2. Add/Edit a Color Rule for a "Calculated Value" in Graphical Table using IronPython Scripting.  This will make sure certain values stand out with a specific color or formatting.

    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 Spotfire.Dxp.Application.Visuals.Miniatures import CalculatedValueRule
    from System.Drawing import *
    from Spotfire.Dxp.Application.Visuals import  ConditionalColoring
    from Spotfire.Dxp.Application.Visuals.ConditionalColoring import ConditionValue
    from Spotfire.Dxp.Application.Visuals.ConditionalColoring import StringComparisonOperator,RuleComparisonOperator
    
    for vis in Document.ActivePageReference.Visuals:  
    	if vis.TypeId == VisualTypeIdentifiers.GraphicalTable:
    		
    		
    		viz = vis.As[GraphicalTable]()
    		viz.Title = 'GraphicalTable'
    		viz.Legend.Visible = True
    		viz.HeaderColumnWidth =150
    
    		for c in viz.Columns:
    			viz.Columns.Remove(c)
    
    		
    		(status,NewColumn) = viz.Columns.AddNew[CalculatedValueMiniatureVisualization]()
    		NewColumn.AutoConfigure()
    		NewColumn.Title = 'CalcVal'
    		
    		NewColumn.ValueAxis.Rules.AddRangeRule(ConditionValue.CreateLiteral(101714.63),ConditionValue.CreateLiteral(117148494.73),Color.FromName("Red"),FontStyle.Italic)
    		#NewColumn.ValueAxis.Rules.AddTopNRule(ConditionValue.CreateLiteral(3),Color.FromName("Red"),FontStyle.Italic)
    		#NewColumn.ValueAxis.Rules.AddExpressionRule('[Axis.Value] > 279062',Color.FromName("Red"),0)
    		#NewColumn.ValueAxis.Rules.AddBottomNRule(ConditionValue.CreateLiteral(3),Color.FromName("Red"),0)
    		#NewColumn.ValueAxis.Rules.AddThresholdRule(RuleComparisonOperator.Greater,ConditionValue.CreateLiteral(413090.743550005),Color.FromName("Red"),0)
    		#NewColumn.ValueAxis.Rules.AddBottomNRule(3,Color.FromName("Red"),0)
     

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