Export (0) Print
Expand All

ChTrendline Object

Office 2003
ChSeries
ChTrendlines
ChTrendline
Multiple objects

Represents a trendline on a chart. A trendline shows the trend, or direction, of data in a series. The ChTrendline object is a member of the ChTrendlines collection.

Using the ChTrendline object

Use the Add method of the ChTrendlines object to add a trendline to a series.

The following method and property return a ChTrendline object.

The ChTrendlines collection's Add method

The ChTrendlines collection's Item property

The following example adds a trendline to the first series in the first chart in Chartspace1 and then formats the trendline.

Sub AddPolyTrendline()

    Dim serSeries1
    Dim chConstants
    Dim tlSeries1Trend

    Set chConstants = ChartSpace1.Constants

    ' Set a variable to the first series of the first chart
    ' in Chartspace1.
    Set serSeries1 = ChartSpace1.Charts(0).SeriesCollection(0)

    ' Add a trendline to the first series and return
    ' a Trendline object.
    Set tlSeries1Trend = serSeries1.Trendlines.Add

    ' Display the equation used to calculate the trendline.
    tlSeries1Trend.IsDisplayingEquation = True

    ' Set the trendline to be a polynomial trendline.
    tlSeries1Trend.Type = chConstants.chTrendlineTypePolynomial

End Sub

		


Methods | Select Method

Parent Objects | ChSeries

Child Objects | ChDataLabel | ChLine | ChSeries


Show:
© 2015 Microsoft