How to use d3Plus in wrapping svg in svg ?
up vote
0
down vote
favorite
<g id="group" opacity="1" style="pointer-events:inherit">
<rect x="504.5" y="384.3" class="class" width="76.6" height="38.5" id="svg_24" style="pointer-events:inherit" />
<text transform="matrix(0.9 -0.000105047 0.000116718 1 481.583 433.508)" class="test" id="svg_25" y="-11.997081870992588" x="27.779332551456037" style="pointer-events:inherit">Very Long Very Long Very Long Text</text>
</g>
I have this svg,I want to wrap the text inside rect using d3plus.
javascript svg d3plus
add a comment |
up vote
0
down vote
favorite
<g id="group" opacity="1" style="pointer-events:inherit">
<rect x="504.5" y="384.3" class="class" width="76.6" height="38.5" id="svg_24" style="pointer-events:inherit" />
<text transform="matrix(0.9 -0.000105047 0.000116718 1 481.583 433.508)" class="test" id="svg_25" y="-11.997081870992588" x="27.779332551456037" style="pointer-events:inherit">Very Long Very Long Very Long Text</text>
</g>
I have this svg,I want to wrap the text inside rect using d3plus.
javascript svg d3plus
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
<g id="group" opacity="1" style="pointer-events:inherit">
<rect x="504.5" y="384.3" class="class" width="76.6" height="38.5" id="svg_24" style="pointer-events:inherit" />
<text transform="matrix(0.9 -0.000105047 0.000116718 1 481.583 433.508)" class="test" id="svg_25" y="-11.997081870992588" x="27.779332551456037" style="pointer-events:inherit">Very Long Very Long Very Long Text</text>
</g>
I have this svg,I want to wrap the text inside rect using d3plus.
javascript svg d3plus
<g id="group" opacity="1" style="pointer-events:inherit">
<rect x="504.5" y="384.3" class="class" width="76.6" height="38.5" id="svg_24" style="pointer-events:inherit" />
<text transform="matrix(0.9 -0.000105047 0.000116718 1 481.583 433.508)" class="test" id="svg_25" y="-11.997081870992588" x="27.779332551456037" style="pointer-events:inherit">Very Long Very Long Very Long Text</text>
</g>
I have this svg,I want to wrap the text inside rect using d3plus.
javascript svg d3plus
javascript svg d3plus
edited Nov 20 at 10:38
asked Nov 19 at 14:12
Shahid
248
248
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can give the text a background rect using a flood filter. I added spacer elements to give the box a little padding, so to speak. See the following snippet:
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can give the text a background rect using a flood filter. I added spacer elements to give the box a little padding, so to speak. See the following snippet:
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
add a comment |
up vote
0
down vote
You can give the text a background rect using a flood filter. I added spacer elements to give the box a little padding, so to speak. See the following snippet:
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
add a comment |
up vote
0
down vote
up vote
0
down vote
You can give the text a background rect using a flood filter. I added spacer elements to give the box a little padding, so to speak. See the following snippet:
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
You can give the text a background rect using a flood filter. I added spacer elements to give the box a little padding, so to speak. See the following snippet:
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
.spacer {
fill: transparent;
}
<svg width="400" height="160" viewBox="0 0 400 160">
<defs>
<filter x="0" y="-0.5" width="1" height="2" id="solid">
<feFlood flood-color="#b2f4f4"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<text
filter="url(#solid)"
y="40"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Very Long Very Long Very Long Text
<tspan class="spacer">.</tspan>
</text>
<text
filter="url(#solid)"
y="100"
x="40"
style="pointer-events:inherit">
<tspan class="spacer">.</tspan>
Short Text
<tspan class="spacer">.</tspan>
</text>
</svg>
answered Nov 20 at 23:30
Ted
10.6k11943
10.6k11943
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
add a comment |
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
I cant add filters in my case,is there any way we can achieve it with js library?
– Shahid
Nov 21 at 5:37
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376478%2fhow-to-use-d3plus-in-wrapping-svg-text-in-svg-rect%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown