xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From villejck <ville...@yahoo.com>
Subject JFreeChart to SVG, No XML Tag, Store Into String
Date Wed, 11 Apr 2007 20:03:56 GMT

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'

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",
		DOMImplementation domImpl =
		Document document = domImpl.createDocument(null, "svg", null);
		SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
		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: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message