ComponentOne Chart 8.0 for ActiveX
DataPolynomial Method (Chart2DData)

 

DataPolynomial Method (Chart2DData)

(DataPolynomial(Xvalues) As Double, Yvalues() As Double, Coefficients() As Double) Calculates the set of coefficients of the approximating obtained by the method of least squares using the x and y data specified by the XValues and YValues arrays. 

Syntax

Function DataPolynomial(xArray, yArray, Coefficents) As Boolean

Remarks

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 xvalues(1 To 50) As Double, yvalues(1 To 50) As Double

Dim c(0 To 3) As Double

 

Call SetXandYValues(xvalues, yvalues)

Call Chart2D.ChartGroups(1).Data.DataPolynomial(xvalues, yvalues, 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: Datapoints with X or Y values equal to the Chart2DData object hole value are excluded from the least squares calculation.

See Also

Chart2DData Object

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback