PHP flexibility to work with images on a large number of formats is a fantastic funcionality.
GD library offers that capacity on Linux and Windows.
Right next follows a small example showing how function are mounted to create an image.
This code generates the next image above
Just in case, if you need some professional class to generate statistics graphics i have one available only for a just 25€ , please contact me at gutoferreira69[@]hotmail.com
Follows an graphic example builded with that class