I can display the Polynomial equation by the following code, onething
unsatisfactory it returns a 2 order Polynomial equation by default. but
I need to get the 4 order Polynomial equation for further process.
Your earliest reply will be highly appreciated!
xlBook.ActiveChart.SeriesCollection(1).Trendlines.Add(Type:=xlPolynomial, Forward:=0, Backward:=0, DisplayEquation:=True).Select
add
to your statement.Order:=4
It works! Thanks!
Actually my Excel works background because I just want to leverage the equation it returns.
At the same time, I use a ChartSpace control in foreground to show the same 4 order Polynomial curve with the following code.Same question with the above solved Excel question, the Chartspace control just returns a 2 order Polynomial curve which I prefer that of 4 order. I tried to insert the parameter of " order = 4 " in somewhere of the following code but failed.
Would you please solved this my last mile project question for me?
BTW may I hold the " Mark As answer" for a while in case others don't see my this further chartSpace question?
Anyway I'll " Mark As answer" and start a new thread if my last question can't be solve for some days. thanks for your understanding.
My chartSpace code as follows:
Dim chConstants
Dim axValueAxis
Dim chtChart1
Set chConstants = ChartSpace1.Constants
' Set the data source of ChartSpace1 to Spreadsheet1.
Set ChartSpace1.DataSource = Me.sdstPlatevalue
' Set a variable to a new chart in Chartspace1.
Set chtChart1 = ChartSpace1.Charts.Add
' Set the chart type.
chtChart1.Type = chConstants.chChartTypeScatterMarkers
chtChart1.SetData chConstants.chDimXValues, chConstants.chDataBound, "A1:A5"
chtChart1.SetData chConstants.chDimYValues, chConstants.chDataBound, "B1:B5"
Set axValueAxis = ChartSpace1.Charts(0).Axes(0)
' The following two lines of code turn off the major and
' minor gridlines for the value axis.
axValueAxis.HasMajorGridlines = False
axValueAxis.HasMinorGridlines = False
Set axValueAxis = ChartSpace1.Charts(0).Axes(1)
' The following two lines of code turn off the major and
' minor gridlines for the value axis.
axValueAxis.HasMajorGridlines = False
axValueAxis.HasMinorGridlines = False
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 = False
tlSeries1Trend.IsDisplayingRSquared = False
' Set the trendline to be a polynomial trendline.
tlSeries1Trend.Type = chConstants.chTrendlineTypePolynomial
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks