Domanda

I am creating a chart using raphael.js. In my chart there are rectangles which are connected using arrows. I am exporting this svg using Raphael Export and then converting this svg string to pdf using batik. But in the pdf i am not getting the arrowheads at the connectors connecting the various rectangles in the pdf. I am using raphael graffle for creating connection between rectangles. I really need those arrows in the pdf. Please let me know what could be the issue.

Also adding defs tag statically and replacing the arrow-head attribute with marker-end-url by manipulating the svg string doesn't looks like a good solution.Is there any other way of doing it.?

È stato utile?

Soluzione

I think i have found the issue. It seems like the issue is with the defs tag(that contains the marker ids) of raphael are not included in exported svg and also marker-end-url attribute is not present in the path elements because of which arrow-heads are not showing. In path elements of rapahel, while export, instead of marker id another attribute is added which is "arrow-end": "classic-midium-midium". So when i added the defs tag of raphael into my generated svg and replace the arrow-end attribute with the marker-end-url attribute by giving the required value the arrow heads appeared. But now the issue is with the positioning of arrow heads. In the exported svg the x and y coordinates of horizontal and vertical arrowheads is slightly more which leads to intersection of arrows with the object(rectangles in my case) which doesn't look good. But yes for now i am going with it.I have modify raphael.export.js. So for any one who looking for solution have to add following 2 lines of code in raphael.export.js

1.In R.fn.toSVG function add following after initialization of svg variable at line number 217 You have to append defs tag of raphael to svg variable here. Not able to post here.

2.In the serializer variable where the tag for path is creatd add following line at line number 199 initial['marker-end'] = "url(#raphael-marker-endclassic33)";

Thanks

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top