Re: Auto-generating a graphs Y scale

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 10:01 AM +0100 8/25/08, Richard Heyes wrote:
Can anyone give me some pointers for auto generating an appropriate Y
scale for a graph (eg a bar/line graph). Much like JPGraph does.

Thanks.

--
Richard Heyes


Richard:

First, the y scale is the one that runs up and down and not right to left.  :-)

Second, the physical length of the y scale should be static and whatever you want it to be (i.e., 5 inches, 10 inches, etc.).

Third, to plot points along this axis simply take the maximum value found in their Y coordinate and divide that into the physical length of the Y scale, such as 10 inches/1500. That will give you a delta value by which you can multiply all values to get their position on the y scale.

Do the same for x, and you have a scatter graph. Do the same for x, sort x, connect the dots and you have a line graph. Do the same for x and provide a range for x and you have a bar chart.

Here's an example:

http://webbytedd.com/aa/stdev/

At least I think that's what you're asking.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux