Getting Forecasting error while generating trend line chart series in ASP.NET

BeUnique 2,332 Reputation points
2022-03-10T09:15:21.037+00:00

I am trying to pull Trend Line chart in my application. I tried many ways to bring the Trend Line chart. But, Got Failed.

I tried the below code to bring Trend Line chart. But, I am getting Error.

If the below error solved, then my trend line chart working which is using in-build asp.net control.

Also, if the error clears, then i am going to use this Trend Line Chart many places inside my application.

Can anyone help us to bring this chart without any problem in my application....?

below id error :

Forecasting Error - There are two data points for this regression type. A minimum of 2 data points are required.

Chart1.DataManipulator.FinancialFormula(FinancialFormula.Forecasting,"Linear,1,false,false",chart1.Series[0], Chart1.Series["TrendLineSeries"]);

below is code


<asp:Chart ID="Chart1" runat="server">
<Series>
<asp:Series Name="Series1" ChartArea="ChartArea1" XValueType="Int32" ChartType="FastPoint" YValuesPerPoint="2" Color="Red" IsVisibleInLegend="true" IsXValueIndexed="true"></asp:Series>
<asp:Series BorderWidth="1" Name="TrendLineSeries" ChartType="Line" BorderColor="Blue"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisX Title="Weight" Crossing="Auto"></AxisX>
<AxisY Title="Price (Euro)"></AxisY>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>

Developer technologies | ASP.NET | Other
{count} votes

Accepted answer
  1. Yijing Sun-MSFT 7,096 Reputation points
    2022-03-11T05:19:46.167+00:00

    Hi @BeUnique ,
    First, the syntax of the predict function is:

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

    And then, I need you check if you have more than 2 data points in your binding. If you make sure that you have bind more than 2 data points, you need to move the Financial Formula code below where the data is bound.

    Best regards,
    Yijing Sun

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.