|
Standard Deviation / Bell Curve Chart. |
Posted by Jeff Morlen on Nov-19-2008 05:57 |
|
OK, I get how to plot a bell curve / std.dev. chart using a SPLine.
Anyone got the math functions, in ASP, to take a set of data and do it?
Thanks! |
Re: Standard Deviation / Bell Curve Chart. |
Posted by Peter Kwan on Nov-19-2008 14:51 |
|
Hi Jeff,
The bell curve (normal distribution curve) is a constant curve. It does not depend on any data. Since the curve is a constant, I think most people will look up the bell curve from a normal distribution table.
Because only a few points are needed to plot a smooth curve, in ASP code, you may just use a few hard coded values, in which the values can be copied from the normal distribution table.
There is an ASP example code in the ChartDirector Forum as follows:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_general&thread=1153402586#N1153484064
You can see from the above code that no data are needed to plot the curve. The values of the hard coded data array "normalDistribution" are copied from the normal distribution table.
The sample code shows 3 labels "AAAA", "BBBB" and "CCCC". These 3 labels are for human reading only, and will not affect the curve itself. You can replace it with any labels you like.
Some people will put the "arithmatic mean" as the "AAAA" label, in which case you need to obtain the mean value from your data. If your data are from a SQL databae, the database will compute these values for you (see the SQL AVG function0. If you need the standard deviation as well, most SQL databases also have a function to compute it.
ChartDirector also has a simple utility to compute mean and standard deviation. It is:
mean = cd.ArrayMath(data).avg()
stddev = cd.ArrayMath(data).stdDev()
Hope this can help.
Regards
Peter Kwan |
|