You can't run Swing code in a servlet. Well, perhaps you can, but the actual displaying of the Swing components won't work. You'll need an applet for that, or use a different way for showing the graph.
The good news is, an image can work:
Of course you can use "image/jpeg" and "JPEG" instead of PNG if you prefer JPG images.