Object Reference > Chart2DData Object > Chart2DData Object Methods > SeriesPolynomial Method (Chart2DData) |
SeriesPolynomial Method (Chart2DData)
SeriesPolynomial(Series As Long, Coefficients() As Double)
Calculates the set of coefficients of the approximating obtained by the method of least squares using the x and y data of the specified physical Series or 0 for all series.
Function SeriesPolynomial(Series As Long, Coefficents) As Boolean
The order of the approximating polynomial is specified by the number of elements of the Coefficients array passed to the method which is one more than the order. If the number of elements of the Coefficients array is greater than or equal to the number of data points, the higher order Coefficients elements are zeroed as appropriate. The index of each element of the Coefficients array matches the power of the independent variable in the term of the polynomial.
If the Coefficients are successfully calculated, the method returns True, otherwise, False.
For example, to obtained a third order appropriating polynomial for Series 2:
Dim c(0 To 3) As Double
Chart2D.ChartGroups(1).Data.SeriesPolynomial(2, c)
If the method call returns True, then c() defines the approximating polynomial:
Y = c(0) + c(1)*X + c(2)*X**2 + c(3)*X**3
Note: Dataholes are excluded from the least squares calculation.
See Also