Spotfire 如何更改使用 Iron 计算总计 Python

Spotfire How To Change Calculate Totals Using Iron Python

我的 Spotfire 仪表板中有一个十字 Table,我正在尝试使用 Iron Python 脚本更改 "Calculate Totals" 选项。

我找到了 this link on Spotfire API. So, from what I understood, this information is stored in myVis.Totals. But, for whatever the reason, this seems to be a read-only property as can be seen here

你们中有人遇到过这个问题并且知道如何解决吗?

这是我的代码:

from Spotfire.Dxp.Application.Visuals import *

# myVis is a script parameter of the type "Visualisation"
myVis = myVis.As[Visualization]()
myVis.Totals = CrossTableTotals.CalculationMode.SumOfCellValues

这是我遇到的错误:

Traceback (most recent call last):
  File "<string>", line 5, in <module>
AttributeError: can't assign to read-only property Totals of type 'CrossTablePlot'


System.MissingMemberException: can't assign to read-only property Totals of type 'CrossTablePlot'
   at CallSite.Target(Closure , CallSite , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
   at Spotfire.Dxp.Application.IronPython27.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)

试试这个

myVis.Totals.DefaultCalculationMode=CrossTableTotals.CalculationMode.SumOfCellValues

盖亚