ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How trend line coordinates is calculated.
Posted by Megha agarwal on Oct-31-2017 17:46
Hi,
I am struggling to figure out where in the chartDirector code trend line coordinates is getting calculated and also wants to know how it calculates without passing the x-coordinate in the data. Currently we are passing only y coordinate values to figure the trend line.

  Re: How trend line coordinates is calculated.
Posted by Peter Kwan on Nov-01-2017 01:30
Hi Megha,

If you only use y-coordinates, then the x-coordinates are assumed to be the array index 0, 1, 2, 3, 4, ....

Given the (x, y) coordinates, internally, ChartDirector will compute the trend line parameters (for a linear trend line, it is the slope and intercept). ChartDirector then compute the two end points of the trend line segment that is within the plot area. Then it will join the two end points with a line.

The "Confidence Band" sample code demonstrates how to obtain the slope and intercept computed by ChartDirector. You can use them to compute your own coordinates along the line.

http://www.advsofteng.com/doc/cdcpp.htm#confidenceband.htm

Hope this can help.

Regards
Peter Kwan