locked
Regression trendline not visible through data points, only the forecast RRS feed

  • Question

  • I am adding a regression line to a scatter plot of XY data, but the trend line does not display within the realm of the data points, only beyond.  This is the regression VB syntax I'm using:

    Chart1.DataManipulator.FinancialFormula(FinancialFormula.Forecasting, "Linear,0,false,false", "Unused:Y", "r-Unused:Y")

    The data input is from the Unused data series and the regression line output is from the r-Unused series. I tried to put a picture in this posting, but couldn't figure it out so here is a link to a picture of the chart: 

    http://mrktvalu.com/images/clipboard01.pdf

    Any help would be appreciated.  Happy holiday! -BGood
    Wednesday, December 24, 2008 9:02 PM

Answers

  • The "r-Unused" series on your screenshot doesn't have any data. In order to narrow down the issue try creating another chart and put there just the "Unused" series. Then use the code that you posted - that should give you the right results. After that try adding other series.
    Monday, December 29, 2008 6:36 PM
  • That was it.  The data series used as input for the regression must be in sorted order before the chart's financialformula.forecasting call is made.  Thanks for your help in arriving at this conclusion.  -Brian
    Wednesday, December 31, 2008 4:43 AM

All replies

  • The "r-Unused" series on your screenshot doesn't have any data. In order to narrow down the issue try creating another chart and put there just the "Unused" series. Then use the code that you posted - that should give you the right results. After that try adding other series.
    Monday, December 29, 2008 6:36 PM
  • Victor: In this dataset, the "Unused" and "All" data series are coincident, each consisting of 22 data points.  By exploring the data point properties of the regression lines, shown as r-Unused and r-All in the chart legend, I have verified that the data points of the regression series are also coincident and consist of 22 data points.  The graphical representations (both points and lines) do not display separately because they are coincident and hide each other.

    One thing I do notice is that the trend line data points are not sorted, and the 1st data point (#0) is x=15276 y=22, which is where the origin of the regression line appears on the chart.  The only other higher data point for the regression line is #13 where x=18550 y=18.  Data points (<) to the left of data point #0 are ignored in the plot of the trendline.

    Could it be that because the regression line dataset is not sorted, only the data points to the right of the origin are being plotted?  That is what appears to be happening.

    Thanks,

          -Brian

    Wednesday, December 31, 2008 4:12 AM
  • That was it.  The data series used as input for the regression must be in sorted order before the chart's financialformula.forecasting call is made.  Thanks for your help in arriving at this conclusion.  -Brian
    Wednesday, December 31, 2008 4:43 AM
  • Just incase anyone else was curious, the datasource, whether it is a dataset or dataview or whatever, must be sorted prior to calling the financialformula.forecasting method.  It took me some time to figure this out after many trial-n-error tries.
    Friday, January 2, 2009 5:53 PM