Im not really sure about this but Im guessing its because you're sending the "image/png" content type. It obviously wont output the HTML but I am wondering why its outputting the image correctly too. I'd think that the HTML would screw it up somewhat.
Anyways, try putting the dynamic image into another file such as "graphimage.php" and output the html into another file.
File 1 = Includes/HTML
File 2 = Outputs dynamic image.
Give it a try.