Spotfire.DXP 中需要控制 "Lines & Curves" 的对象或 属性
Need Object or Property in Spotfire.DXP that controls "Lines & Curves"
我在 Spotfire 中通过 IronPython 脚本控制散点图。
我找不到必要的 属性 或对象来创建或控制在散点图中使用 "Lines & Curves" 选项创建的 "Line from Column"。 (见附图):
附上我的脚本,除了最后一行我需要帮助外,它都运行良好。
from Spotfire.Dxp.Application.Visuals import VisualContent
from Spotfire.Dxp.Application.Visuals import ScatterPlot
if yAxisNormalization == "Norm0" and yAxisAllorAverage == "Individual":
#======= Norm0, Individual
sTitle = "Individual Values Normalized To Baseline"
sYAxisFormula = "Avg([val_t0_offset]) Over (Intersect([Week],[Subj_ID]))"
sErrorBars = "StdDev([val_t0_offset]) over (Intersect([Subj_ID],[Week]))"
elif yAxisNormalization == "Norm0" and yAxisAllorAverage == "Average":
#======= Norm0, Average
sTitle = "Treatment Averaged Values Normalized To Baseline"
sYAxisFormula = "Avg([val_t0_offset]) Over (Intersect([Week],[Treatment]))"
sErrorBars = "StdDev([val_t0_offset]) over (Intersect([Treatment],[Week]))"
elif yAxisNormalization == "NotNorm" and yAxisAllorAverage == "Individual":
#======= No Normalizaiton, Individual, just raw
sTitle = "Individual Measured Values"
sYAxisFormula = "Avg([Val]) Over (Intersect([Week],[Subj_ID]))"
sErrorBars = "StdDev([Val]) over (Intersect([Subj_ID],[Week]))"
elif yAxisNormalization == "NotNorm" and yAxisAllorAverage == "Average":
#======= No Normalizaiton, Averaged data
sTitle = "Treatment Averaged Values"
sYAxisFormula = "Avg([Val]) Over (Intersect([Week],[Treatment]))"
sErrorBars = "StdDev([Val]) over (Intersect([Treatment],[Week]))"
# ======================= setup line connection based on aggrigation ==========================
if yAxisAllorAverage == "Individual":
sLineConnection= "<[Subj_ID]>"
elif yAxisAllorAverage == "Average":
sLineConnection= "<[Treatment]>"
if yAxisNormalization == "NotNorm":
sOutlierValue = "<[val_t0_offset]>"
elif yAxisNormalization == "Norm0":
sOutlierValue= "<[Val]>"
#set the title
visual.Title = sTitle
#set the Y formula
scatterPlot = visual.As[ScatterPlot]()
scatterPlot.YAxis.Expression = sYAxisFormula
#ERROR BARS
scatterPlot.YAxis.ErrorBars.UpperExpression = sErrorBars
scatterPlot.YAxis.ErrorBars.LowerExpression = sErrorBars
scatterPlot.YAxis.ErrorBars.Enabled = True
# ------ redifine line connection ------------------
scatterPlot.LineConnection.ConnectionAxis.Expression = sLineConnection
# ---- change grey outlier bars ---------------------
######### NEED HELP HERE! ##############################
# how do I set the Yvalue for a Line created in Lines and Curves? ###
scatterplot.(linesAndCUrves??).(line[0]?).YvaluesColumn = sOutlierValue <<<this is the line where I need help.
#############################################################
#############################################################
我个人没有用过这个,但我想你想要 FittingModelCollection object, specifically the method AddColumnValuesLine。
来自@niko 的 link,从列中获取两条水平线的完整代码是:
sMinCol = "Test_t0_min"
sMaxCol = "test_T0_max"
# --- OUTLIER DEMARKATION LINES: --
oDataTable = Document.Data.Tables['all_results']
oXCol = oDataTable.Columns['Week']
scatterPlot.FittingModels.Clear()
#lower
oYCol = oDataTable.Columns[sMinCol]
oColumnValuesLine = scatterPlot.FittingModels.AddColumnValuesLine(oDataTable, oXCol, oYCol)
oColumnValuesLine.AffectAxisRanges = True
oColumnValuesLine.Line.Width = 3
#upper
oYCol = oDataTable.Columns[sMaxCol]
scatterPlot.FittingModels.AddColumnValuesLine(oDataTable, oXCol, oYCol)
oColumnValuesLine.AffectAxisRanges = True
oColumnValuesLine.Line.Width = 3
我在 Spotfire 中通过 IronPython 脚本控制散点图。
我找不到必要的 属性 或对象来创建或控制在散点图中使用 "Lines & Curves" 选项创建的 "Line from Column"。 (见附图):
附上我的脚本,除了最后一行我需要帮助外,它都运行良好。
from Spotfire.Dxp.Application.Visuals import VisualContent
from Spotfire.Dxp.Application.Visuals import ScatterPlot
if yAxisNormalization == "Norm0" and yAxisAllorAverage == "Individual":
#======= Norm0, Individual
sTitle = "Individual Values Normalized To Baseline"
sYAxisFormula = "Avg([val_t0_offset]) Over (Intersect([Week],[Subj_ID]))"
sErrorBars = "StdDev([val_t0_offset]) over (Intersect([Subj_ID],[Week]))"
elif yAxisNormalization == "Norm0" and yAxisAllorAverage == "Average":
#======= Norm0, Average
sTitle = "Treatment Averaged Values Normalized To Baseline"
sYAxisFormula = "Avg([val_t0_offset]) Over (Intersect([Week],[Treatment]))"
sErrorBars = "StdDev([val_t0_offset]) over (Intersect([Treatment],[Week]))"
elif yAxisNormalization == "NotNorm" and yAxisAllorAverage == "Individual":
#======= No Normalizaiton, Individual, just raw
sTitle = "Individual Measured Values"
sYAxisFormula = "Avg([Val]) Over (Intersect([Week],[Subj_ID]))"
sErrorBars = "StdDev([Val]) over (Intersect([Subj_ID],[Week]))"
elif yAxisNormalization == "NotNorm" and yAxisAllorAverage == "Average":
#======= No Normalizaiton, Averaged data
sTitle = "Treatment Averaged Values"
sYAxisFormula = "Avg([Val]) Over (Intersect([Week],[Treatment]))"
sErrorBars = "StdDev([Val]) over (Intersect([Treatment],[Week]))"
# ======================= setup line connection based on aggrigation ==========================
if yAxisAllorAverage == "Individual":
sLineConnection= "<[Subj_ID]>"
elif yAxisAllorAverage == "Average":
sLineConnection= "<[Treatment]>"
if yAxisNormalization == "NotNorm":
sOutlierValue = "<[val_t0_offset]>"
elif yAxisNormalization == "Norm0":
sOutlierValue= "<[Val]>"
#set the title
visual.Title = sTitle
#set the Y formula
scatterPlot = visual.As[ScatterPlot]()
scatterPlot.YAxis.Expression = sYAxisFormula
#ERROR BARS
scatterPlot.YAxis.ErrorBars.UpperExpression = sErrorBars
scatterPlot.YAxis.ErrorBars.LowerExpression = sErrorBars
scatterPlot.YAxis.ErrorBars.Enabled = True
# ------ redifine line connection ------------------
scatterPlot.LineConnection.ConnectionAxis.Expression = sLineConnection
# ---- change grey outlier bars ---------------------
######### NEED HELP HERE! ##############################
# how do I set the Yvalue for a Line created in Lines and Curves? ###
scatterplot.(linesAndCUrves??).(line[0]?).YvaluesColumn = sOutlierValue <<<this is the line where I need help.
#############################################################
#############################################################
我个人没有用过这个,但我想你想要 FittingModelCollection object, specifically the method AddColumnValuesLine。
来自@niko 的 link,从列中获取两条水平线的完整代码是:
sMinCol = "Test_t0_min"
sMaxCol = "test_T0_max"
# --- OUTLIER DEMARKATION LINES: --
oDataTable = Document.Data.Tables['all_results']
oXCol = oDataTable.Columns['Week']
scatterPlot.FittingModels.Clear()
#lower
oYCol = oDataTable.Columns[sMinCol]
oColumnValuesLine = scatterPlot.FittingModels.AddColumnValuesLine(oDataTable, oXCol, oYCol)
oColumnValuesLine.AffectAxisRanges = True
oColumnValuesLine.Line.Width = 3
#upper
oYCol = oDataTable.Columns[sMaxCol]
scatterPlot.FittingModels.AddColumnValuesLine(oDataTable, oXCol, oYCol)
oColumnValuesLine.AffectAxisRanges = True
oColumnValuesLine.Line.Width = 3