The MindFusion Forums
Flow Diagramming Components >> ASP.NET MVC >> Additional attributes in SVG export
https://mindfusion.eu/Forum/YaBB.pl?num=1500372292

Message started by Sil r on Jul 18th, 2017 at 10:04am

Title: Additional attributes in SVG export
Post by Sil r on Jul 18th, 2017 at 10:04am
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.

Title: Re: Additional attributes in SVG export
Post by Slavcho on Jul 18th, 2017 at 10:55am
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

Title: Re: Additional attributes in SVG export
Post by Sil r on Jul 19th, 2017 at 1:16pm
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.

Title: Re: Additional attributes in SVG export
Post by Slavcho on Jul 19th, 2017 at 3:21pm
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

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.