Error Bars

These IronPython scripts below show how to modify any of the Line Chart visualization settings found on the Error Bars tab of the Line Chart Properties dialog box in the Spotfire user interface.
Note

In each of the scripts below, it is assumed that the MyVis variable references the targeted visualization. See here for more information about referencing visualizations.

Use Error Bars

This script is equivalent to checking the checkbox in the “Visible error bars” section to turn on the error bars for a visualization.

from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

myVis.YAxis.ErrorBars.Enabled = True

Set the Upper and Lower Error Bar Expressions

The custom expressions below must evaluate to a numeric value, not a categorical value.

Note

If you aren't sure how to write a specific custom expression correctly from scratch, start by building the expression interactively using the Spotfire user interface. Once your custom expression is working correctly, right-click on the custom expression input box selector(s) and choose Custom Expression. You can then copy the expression shown into your IronPython script.

from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

#Set the "Upper error:" expression:
myVis.YAxis.ErrorBars.UpperExpression = "P90([Column1])"

#Set the "Lower error:" expression:
myVis.YAxis.ErrorBars.LowerExpression = "P10([Column2])"

Set the Error Bar Color

The script below is equivalent to selecting either “Same as bar” or “Custom” under the Color section of the Error Bars tab.

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

myVis = myVis.As[Visualization]()

#Choose the "Same as bar" color option:
myVis.YAxis.ErrorBars.UseMarkerColor = True

#Choose the "Custom" color option:
myVis.YAxis.ErrorBars.UseMarkerColor = False
myVis.YAxis.ErrorBars.FixedColor = Color.Red

Show End Caps

The script below is equivalent to checking the “Show end caps” checkbox at the bottom of the “Error Bars” tab.

from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

myVis.YAxis.ErrorBars.ShowEndCaps = True

Include Error Bars in Axis Range

The script below is equivalent to checking the “Include error bars in axis range” checkbox at the bottom of the Error Bars tab.

from Spotfire.Dxp.Application.Visuals import *

myVis = myVis.As[Visualization]()

myVis.YAxis.ErrorBars.IncludeInAxisRange = True
Welcome!

The purpose of this website is to provide a comprehensive, accurate, and efficient IronPython reference for Spotfire developers.