# How do I create a graph with regression lines?

Hi,

I have a simple query that returns 2 columns of variable numeric data that I would like to create a chart from. By using a numeric axis line chart I've been able to plot the individual points. However, I now want to add a regression line based on those points. The regression line could be a simple linear regression, a quadratic regression, or more complex 3 or 4 parameter regressions. Is this possible?

There could be a number of ways of creating the parameters (eg slope and intercept for a linear regression):

a) Crystal Reports could calculate them whilst drawing the line

b) I could create a formula that provides the parameters that CR could use to plot the line

c) I could return the parameters from the database as part of the same or a separate query.

Thanks

##### Cyndi Steele replied

Hi Colin,

I just added a regression line to one of my charts yesterday I did it by right clicking on the line (or in my case it was the bar) on the graph. Then I picked Trendlines. There are about 16 different formulas available. I picked Linear Regression for mine and it gave me exactly what I needed.

Hope that helps,

Cyndi