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:
- Add Calculated Value Column.
- 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
- API Reference: CalculatedValueRuleCollection Methods
- API Reference: ConditionValue Structure
- API Reference: CalculatedValueRuleCollection.AddRangeRule Method
- API Reference: CalculatedValueRuleCollection.AddExpressionRule Method
- API Reference: CalculatedValueRuleCollection.AddThresholdRule Method
- API Reference:CalculatedValueRuleCollection.AddTopNRule Method
- API Reference: RuleComparisonOperator Enumeration
- API Reference:CalculatedValueMiniatureVisualization Class
License: TIBCO BSD-Style License
Back to IronPython Scripting in Spotfire Examples
Recommended Comments
There are no comments to display.