SVG output missing tool-tips

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
satish.mundra
Posts: 1
Joined: Sat Aug 06, 2016 4:07 pm
antibot: No, of course not.

SVG output missing tool-tips

Post by satish.mundra » Sun Aug 07, 2016 8:46 am

Hi,

I am new to JFreechart and I am using the api to generate and SVG output of the chart. When I see the output as Java Frame I have tool-tips working fine when I hover with the mouse. These tool-tips are missing in the SVG output.

Need guidance if I am missing something in the code below which I use to export as SVG output:


ByteArrayOutputStream os_writer = new ByteArrayOutputStream();

BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os_writer));

JFreeChart chart = getGraph(userId, siteId, periodId, dataSource);

/* Get DOM Implementation */
DOMImplementation svgDOM= GenericDOMImplementation.getDOMImplementation();
/* create Document object */
Document document = svgDOM.createDocument(null, "svg", null);
/* Create SVG Generator */
org.apache.batik.svggen.SVGGraphics2D svgGenerator = new org.apache.batik.svggen.SVGGraphics2D(document);
chart.setTextAntiAlias(true);
/* Render chart as SVG 2D Graphics object */
chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, 640, 480), null);
/* Write output to file */
try {
svgGenerator.stream(writer,true);
} catch (SVGGraphics2DIOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return os_writer.toByteArray();





The output generated does not have tool-tip information.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: SVG output missing tool-tips

Post by paradoxoff » Mon Aug 08, 2016 12:28 pm

I never had to dive that deeply into advanced options for graphics export.
The generated SVG is apparently only containing the "drawing commands", and the item storage is not part of that.
Maybe this thread is helpful.

Locked