简体   繁体   English

AddThresholdColorRule给出错误Spotfire(Iron Python)

[英]AddThresholdColorRule giving error Spotfire (Iron Python)

from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Application.Visuals.ConditionalColoring import *
from System.Drawing import Color

# Get the visualization reference
for visualization in Document.ActivePageReference.Visuals:
  if visualization.Title == "Test Bar Chart1":
    visualContentObject = visualization.As[VisualContent]()

#Clear default coloring
visualContentObject.ColorAxis.Coloring.Clear()
#set color
visualContentObject.ColorAxis.Coloring.AddThresholdColorRule(StringComparisonOperator.GreaterOrEqual, ConditionValue.CreateLiteral('40'), Color.FromName("Green"))

I have a string column in Value Axis which I want to conditionally color green for values greaterorequal than 40.I have tried this code but it gives an error no attribute named GreaterOrEqual 我在Value Axis中有一个字符串列,我想有条件地将绿色表示大于40的值。我已经尝试过此代码,但是它给出了错误,没有名为GreaterOrEqual的属性

The script parameters that I have defined are visualization and visualContentObject both of them point to the bar chart in the visualization 我定义的脚本参数是可视化和visualContentObject,它们都指向可视化中的条形图。

you have written: 你写:

StringComparisonOperator.GreaterOrEqual

you should have written: 您应该写:

RuleComparisonOperator.GreaterOrEqual

:) :)

source: API docs 来源: API文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM