If you're using a web browser to display the image, you could use
VML I think.
I used it recently to create a pie chart from different MySQL queries whilst on work experience. I was using asp.net and vb.net as well as jscript though. I'm not sure if it's what you want but thought I'd give my 2 cents =p