I have a SVG image (a Map of a country) and I am trying to add a JfreeChart on top of it which would show 3d Bars on particular locations. Can someone please help point out how do i add a JfreeChart to an existing SVG image.
Following is the code so far
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory sax = new SAXSVGDocumentFactory(parser);
String uri = "file:///F://WorldMap.svg";
SVGDocument doc = sax.createSVGDocument(uri);
SVGGraphics2D my_svg_generator = new SVGGraphics2D(doc);
// Create a converter for this document.
SVGGraphics2D g = new SVGGraphics2D(doc);
//got a JfreeChart from a static method depending on data
JFreeChart chart = createChart(createDataset());
//I can add up normal nodes
Element svgRoot = doc.getDocumentElement();
svgRoot.appendChild(doc.createElementNS("http://www.w3.org/2000/svg", "rect"));
I have tried converting Jfreechart to Bytes and using g.drawBytes() but it renders some garbage on top of the SVG.
Would appreciate if someone can help with this.