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

Message ListMessage List     Post MessagePost Message

  bell shape curve (normal distribution) in php
Posted by Digitalalpha on Jul-20-2016 12:07
Hi Peter,

Can you give me a sample code to draw a bell shape curve (normal distribution) in php language.

Thanks much

  Re: bell shape curve (normal distribution) in php
Posted by Peter Kwan on Jul-20-2016 19:36
Hi Digitalalpha,

There is an example included in ChartDirector 6.0. See:

http://www.advsofteng.com/doc/cdphp.htm#histogram.htm

There is also a very simple example at the following, but it is in ASP:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_general&thread=1153402586#N1153427124

Basically, a bell curve is a fix curve. You do not need any data to draw the curve. The points on the curve can be looked up from a statistics table. In ChartDirector, you just need to have a few points and join them with a spline curve. In the ASP sample code, it uses 13 points (looked up from a statistics table).

After drawing the curve, you can label the center and other parts of the curve using any text. These text can be from your real data. For example, the center is typically labelled using the mean value of your data.

If you need to draw a bell curve with other data representation, such as a histogram as in the PHP sample code above, you may need to shift and resize the bell curve to make it align with the other data representation. For example, the y-coordinates of the curve may need to be adjusted as that the area under the curve is approximately the same as the area of the histogram. This is demonstrated in the PHP sample code above.

Hope this can help.

Regards
Peter Kwan