on 10-13-2015 7:17 PM
I built an SVG image with proper id's so that I can modify it with d3.js using select("#id"). But the problem is I am not able to insert the SVG code into the lumira extension.
The SVG element contains text and this is what I want to modify with d3.js.
But without actually adding the svg code, I cannot modify it with d3.js
Is it correct to say that I would use something like require.js?
Any hints?
thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Federick,
See you already worked out an answer for your question, cool, if you mark this as answered with a link to your blog?
Cheers
Robert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey.
To load a file.svg and then be able to modify it, loading it through an <img> tag won't work.
You have to load it through AJAX, you'll receive the content like if you would have open the svg file in a text editor.
Then using jQuery, just append the content to the main container (using .html() for example), jQuery will take care of it all.
Just be aware that parsing svg afterwards to modify it might be limitated for some selectors. In this case, use pure Vanilla JS.
Br,
Vincent.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is a better description:
I have an svg file that I wrote. Here is a snippet:
<g
id="item5">
<rect
rx="14.811304"
ry="14.811304"
y="925"
x="277.70612"
height="36.18919"
width="200.17131"
id="item2"
transform="translate(0,-520.8662)"
style="display:inline;opacity:1;fill:#f17431;fill-opacity:0.99703232;stroke:none" />
<text
id="item5Text"
y="430"
x="379"
text-anchor="middle"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:25px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';writing-mode:lr-tb;fill:#000000;fill-opacity:0.9910979">1</text>
</g>
<g
id="item6">
<rect
rx="14.811304"
ry="14.811304"
y="925"
x="505.59637"
height="36.18919"
width="200.17131"
id="item3"
style="display:inline;opacity:1;fill:#f17431;fill-opacity:0.99703232;stroke:none"
transform="translate(0,-520.8662)" />
<text
id="item6Text"
y="430"
x="605"
text-anchor="middle"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:25px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';writing-mode:lr-tb;fill:#000000;fill-opacity:0.9910979">2</text>
</g>
I then use d3 to access the values stored in the text and modify them with:
d3.select("item5").text('12');
How can I include my svg specification and then modify it using d3.js in an extension?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you convert all avg based html files into d3, so that interaction will be easy and deployment in SAP Lumira can be done. Refer: https://www.dashingd3js.com/creating-svg-elements-based-on-data
Still not clear, try to post with some example and image
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you say the exact problem! R you trying with webide if so send the error msg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.