Closed bbest closed 3 years ago
Normally in Adobe Illustrator, exporting the Text layer to SVG creates a group g tag with id="text" like so:
g
id="text"
<g id="text">
And this is made toggle-able like so:
Text: ON
Text: OFF
But in Inkscape, it produces:
<g inkscape:groupmode="layer" id="layer2" inkscape:label="text">
So the id is not found by the JS that turns the <g id="text"> OFF by default in: https://github.com/marinebon/nms4r/blob/255edfa951b2489b132535f48b9ddfa5681c887a/inst/template_website/libs/infographiq.js#L156.
So ideally, we can work with both Adobe Illustrator and Inkscape exported SVGs by figuring out the JQuery reference for either. See links for more:
var myElement = $('g[inkscape\\:label="myLabel"]', svg.root());
Issue solved by providing documentation in nms4r vignette how to properly format svg files in Inkscape itself.
Normally in Adobe Illustrator, exporting the Text layer to SVG creates a group
g
tag withid="text"
like so:And this is made toggle-able like so:
Text: ON
Text: OFF
But in Inkscape, it produces:
So the id is not found by the JS that turns the
<g id="text">
OFF by default in: https://github.com/marinebon/nms4r/blob/255edfa951b2489b132535f48b9ddfa5681c887a/inst/template_website/libs/infographiq.js#L156.So ideally, we can work with both Adobe Illustrator and Inkscape exported SVGs by figuring out the JQuery reference for either. See links for more: