A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
- Posts: 106
- Joined: Fri May 27, 2005 7:44 pm
- Location: Boulder, CO
The documentation says:
when an HTML page contains multiple SVG elements, the items within the DEFS element for each SVG element must have IDs that are unique across all SVG elements in the page. We auto-populate the defsKeyPrefix attribute to help ensure that unique IDs are generated.
Is the best (or ok) way to handle this to call setDefsKeyPrefix() with a different string for every SVGGraphics2D we create?
thanks - dave
- JFreeChart Project Leader
- Posts: 11718
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
If you do nothing, the prefix will be unique because it is initialised with:
Code: Select all
this.defsKeyPrefix = String.valueOf(System.nanoTime());
However, this generates a fairly long prefix...if you can manually set shorter prefixes but still guarantee the uniqueness of the keys then you'll save some space in the generated SVG.