Generating embedded hyperlinks

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
Locked
tkannenb
Posts: 2
Joined: Tue Aug 11, 2020 11:21 pm
antibot: No, of course not.

Generating embedded hyperlinks

Post by tkannenb » Fri Aug 14, 2020 2:47 pm

I'm using JFreeSVG to render pie charts generated with JFreeChart. I'm using CustomPieURLGenerator to associate a custom URL with each pie slice, and I'd like the SVG output to include <a> tags linking to those custom URLs. Is there any way to do that directly with JFreeSVG? From a handful of posts I've found in this forum, I'm inclined to think the answer is no, and that the best I can do is to get JFreeSVG to attach some IDs to the slice elements so that I can do some post-processing to attach the URLs after the fact. That appears to be what JFreeChart.setElementHinting is for, but when I set that to true, all that happens is that JFreeSVG adds jfreesvg:ref="JFREECHART_TOP_LEVEL" to the outermost group in the generated SVG output; nothing is added to the groups that represent the pie slices. Can anybody provide an example of how to properly use element hinting, or (even better) an example of how to render JFreeChart slice URLs as embedded links in the SVG?

Locked