logo

New Response

« Return to the main article

You are replying to:

  1. I have a servlet that returns data from a database that allows users to see how much beer has been sold each month against what they proposed.

    I would now like to chart this and SVG seems to be fairly easy to understand.....however, when returning info to the browser I start by saying

    res.setContentType("text/xml"); PrintWriter out = res.getWriter();

    Then I try to write the code (the example is what I am trying to output first)

    out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); out.println("<svg width=\"300\" height=\"300\">"); out.println("<g id=\"db-symbol\" style=\"stroke:#000000\">"); out.println("<rect x=\"20\" y=\"130\" width=\"140\" height=\"140\" fill=\"#41B8D4\"/>"); out.println("<circle cx=\"200\" cy=\"200\" r=\"70\" fill=\"#FFFF5C\"/>"); out.println("<path d=\"M 150,60 L 60,180 L 240,180 Z\" fill=\"#F555A8\"/>"); out.println("</g>"); out.println("</svg>");

    This is probably dumb (I am quite open to ridicule - but preferably advice) on how I get the chart to show!

    Cheers

    Graeme

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: