Why are you generating images on the fly to display a chart? Why not send the data points and render a chart clientside using JavaScript? There are plenty of libraries for that.
A lot of clients want native PDF output for their reports. None of the PDF generating libraries I know of support running JS. So if you want the same charts in both, you need to generate the images server side.
I am sure there are other ways but I found using the native datavisualization library very useful and simple to use. I am one of these guys who do as little javascript as necessary.