Adding a regression formula line to an xy scatter graph

How do I go about adding a formula line to an XY scatter graph in Crystal reports 9? I am able to add the two values to the chart, but cannot add the regression formula line. Please help. Thanks.
Who is Participating?
frodomanConnect With a Mentor Commented:
Yea, their graphing capabilities in particular are way overdue for some additional functionality.
Unfortunately you can't because to the best of my knowledge Crystal supports trendlines only on line charts.

There is a workaround but it's very clumsy.  What you would need to do is to create a separate chart in a section above your scatter graph and then in the section expert check the "Overlay Following Section" option to put your trend chart over the top of the scatter chart.  You can either calculate and graph the trendline manually or create a line chart and insert the regression line then set the primary data lines to transparent (or to the backgroup color).

In order to achieve a clean result you'll need to make sure the xy scales and the total size of both charts are identical.  You'll want to set as much of the overlay chart to transparent as possible and it will still take lots of fine-tuning at 400% zoom to get the remaining lines to overlay each other cleanly.

If you absolutely must do this then the above method will work but IMHO the end result isn't worth the effort it takes.  I would look at other options for representing your data if that's at all possible.

Good luck.

adrianbennettAuthor Commented:
Thanks. Some very strange omissions in Crystal reports IMHO.
Dan WeingartAuthor / CRChartCommented:
I agree that the graphing capabilities are due for some 'overhaul'... and I wrote a lot of the original code!

The big problem with Scatter Charts in Crystal is that the dataset is interpreted as "Many series, each with exactly one marker in it" when what you really want is "one series composed of many markers".  It is impossible to create a regrssion line of a series that has only 1 element.  However, once you can construct this second type, then it is easy to create a linear regression line:  Just go to ChartOptions->General Options and then to the TrendLine tab and select LinearRegression.

I would recommend you download the evaluation version of our CRChart product (which replaces the charting in Crystal Reports). If you use the @SWAP macro you will be able to construct the correct dataset and then add your regression line [Disclaimer: CRChart costs money. I work for the company that makes this product. There may be other solutions available that I am not aware of].

-Dan @ 3D
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.