This documentation is archived and is not being maintained.

ChErrorBars Object

Office 2003
Multiple objects

Represents the error bars for a series. Error bars indicate the degree of uncertainty for chart data. Only series in Radar, Polar, Area, Bar, Column, Line, and XY (Scatter) charts can have error bars. Only series in scatter charts can have x and y error bars. The ChErrorBars object is not a collection. There is no object that represents a single error bar; you either have x error bars or y error bars turned on for all points in a series or you have them turned off.

Using the ChErrorBars object

Use the Add method of the ChErrorBarsCollection object to add error bars to a series.

The following methods return a ChErrorBars object. For more information, see the Help topics for these methods:

The ChErrorBarsCollection object's Add method

The ChErrorBarsCollection object's Item property

The following example adds error bars to the first series in the first chart in ChartSpace1, and then sets the properties for the error bars.

Sub AddErrorBars()

    Dim chConstants
    Dim ebCollection
    Dim ebSeries1

    Set chConstants = ChartSpace1.Constants

    ' Set a variable to the collection of error bars for
    ' the first series in the first chart of Chartspace1.
    Set ebCollection = ChartSpace1.Charts(0).SeriesCollection(0).ErrorBarsCollection

    ' Add error bars to the chart.

    ' Set a variable to the error bars for the data series.
    Set ebSeries1 = ebCollection.Item(0)

    ' Set the error bars so that they represent a certain
    ' percentage of the value of a data point.
    ebSeries1.Type = chConstants.chErrorBarTypePercent

    ' The error bars represent 5% of a data point.
    ebSeries1.Amount = 0.05

End Sub


Parent Objects | ChSeries

Child Objects | ChLine | ChSeries