I would like to generate the SVG without these tags showing up:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>

I would also like to store the SVG code into a string or string buffer
variable. Here is my current code:

public class export2svg {
        
        public static void main(String[] args) throws SVGGraphics2DIOException,
UnsupportedEncodingException {
                DefaultPieDataset dataset = new DefaultPieDataset();
                dataset.setValue("1", 43.2);
                dataset.setValue("2", 27.9);
                dataset.setValue("3", 70.5);
                
                JFreeChart chart = ChartFactory.createPieChart(
                                "Sample Pie Chart",
                                dataset,
                                true,
                                true,
                                false);
                
                DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
                
                Document document = domImpl.createDocument(null, "svg", null);
                
                SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
                
                svgGenerator.getGeneratorContext().setPrecision(6);
                svgGenerator.setSVGCanvasSize(new Dimension(200, 200));
                
                chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, 200, 
200), null);
        
                boolean useCSS = true;
                Writer out = new OutputStreamWriter(System.out, "UTF-8");

                svgGenerator.stream(out, useCSS);
                        
        }
}

I appreciate any advice. Thank you!
-- 
View this message in context: 
http://www.nabble.com/JFreeChart-to-SVG%2C-No-XML-Tag%2C-Store-Into-String-tf3561707.html#a9947346
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to