Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Additional attributes in SVG export (Read 3290 times)
Sil r
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Jul 18th, 2017
Additional attributes in SVG export
Jul 18th, 2017 at 10:04am
Print Post  
Is it possible to export additional attributes to SVG? I'd like to add an Id attribute but I don't seem to find a way to do it.

I tried to set the ShapeNode.Id and ShapeNode.Tag but neither of them show up in the SVG output.

Preferably I would like to export as many custom attributes as I want.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Additional attributes in SVG export
Reply #1 - Jul 18th, 2017 at 10:55am
Print Post  
Hi,

Unfortunately that's not supported at this time. As a work-around you could identify the node paths using hyperlinks and add your attributes using XML API.

E.g. set ShapeNode.Hyperlink="id" and  exporter.HyperLinkStyle = HyperLinkStyle.Shape. Then using xmldoc.SelectSingleNode(xpath) you can find the ShapeNode's <path> surrounded by an a element with href set to your id. You could remove the <a> element, pulling the <path> one level up and assigning attributes to it.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Sil r
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Jul 18th, 2017
Re: Additional attributes in SVG export
Reply #2 - Jul 19th, 2017 at 1:16pm
Print Post  
Hi Slavcho,

The workaround works but only for the shape OR the text element, not for both since the exporter in only generating a link for one of the two.

Can the option HyperLinkStyle.ShapeAndText be added? Or even better, allow a list of custom attributes be added to the SVG export?

Now the SVG export is nice but not customizable at all which might be a showstopper for me.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Additional attributes in SVG export
Reply #3 - Jul 19th, 2017 at 3:21pm
Print Post  
Hi Sil,

We'll have it in mind for next release. At this time you can find the node's text element right after the <a ...><path /></a> for the shape, you could find it along with path's anchor using something like /following-sibling::*[1][self:text] in the XPath expression.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint