forecasting with regression in asp.net chart

1.4k Views Asked by At

I am refering to the official asp.net tutorial http://msdn.microsoft.com/en-us/library/dd456655.aspx . What i did is,,, in an fresh asp.net website, i added a chart control from the toolbox and dragged a table it to from my database. The problem starts now when i added a button and put the forecasting code in the button click event. The code is:

Chart1.DataManipulator.FinancialFormula (FinancialFormula.Forecasting, "2,40,true,true", "Series1:Y", "Series2:Y,Series3:Y,Series3:Y2");

The error message i got is

Forecasting Error – There are too few data points for this regression type. A minimum of 2 data points are required.

In the chart, i selected "date" as x-axis, and "some number" as Y-axis... And what is this minimum of 2 data points required... Can anyone help me out with this error.......

2

There are 2 best solutions below

0
On

This question is a bit old, but I ran across this same situation today and wanted to post my resolution.

This "Too Few Data Points" issue occurs when the the trend line is added before the chart is bound. Simply moving the Financial Formula code below where the data is bound will resolve the issue. (Of course, if you have less than 2 data points in your binding, this won't help you).

Basically, until the chart is bound, the "input series" doesn't actually have the data to be used by the Chart's DataManipulator.

0
On

For predicting the future values at least two past values are needed,so if the result contains only one value it will throw error,because it is not possible to compare the values.The series in the chart should have minimum 2 values