ErrorBarsCollection Property

Microsoft Office Web Components Visual Basic

Returns a ChErrorBarsCollection collection that contains a ChErrorBars object for each set of error bars in the specified series. A series can have only one set of error bars, so the ChErrorBarsCollection collection never contains more than one object. Read-only.

expression.ErrorBarsCollection

expression    Required. An expression that returns a ChSeries object.

Example

This example adds error bars to all of the series in the first chart in ChartSpace1 and then sets the error amount and end style.

Sub Add_Error_Bars()
    Dim ebErrorBars
    Dim serChartSeries
    Dim chConstants

    Set chConstants = ChartSpace1.Constants

    ' Loop through all of the series in the first chart
    ' in ChartSpace1. 
    For Each serChartSeries in ChartSpace1.Charts(0).SeriesCollection

        ' Add error bars to the current series.
        Set ebErrorBars = serChartSeries.ErrorBarsCollection.Add

        ' Set the error bars to be a percentage of the value.
        eberrorBars.Type = chConstants.chErrorBarTypePercent
        
        ' Set the percentage amount.
        ebErrorBars.Amount = 0.05
        
        ' Set the end style of the error bars.
        ebErrorBars.EndStyle = chConstants.chEndStyleNone
    Next
End Sub