tspan inside svg text objects

3,087 views
Skip to first unread message

axi

unread,
Jun 17, 2012, 5:30:51 PM6/17/12
to d3-js
I'm a total noob on d3js and svg and maybe this is an stupid question,
but I can't make multiline texts, when I try to give a value with
<tspan> tags on text attribute
I awalys see the code itself and not the representation.

Is d3js escaping my code? Any thoughts?

Vani

unread,
Aug 1, 2012, 11:54:33 AM8/1/12
to d3...@googlegroups.com
Am facing the same issue. Did you find a solution yet?

axi

unread,
Aug 4, 2012, 3:21:52 PM8/4/12
to d3...@googlegroups.com
Nop even doing it by hand on Chrome inspector I can't do multiline on text svg objects when I'm using d3js.
When I do the same on separate svg it seems to work, so I'm trying to see where is the difference.

Ger Hobbelt

unread,
Aug 5, 2012, 6:07:47 AM8/5/12
to d3...@googlegroups.com
Isn't code like this working?

var tblock = selection.append("text");
tblock.append("tspan")
  .text(line1_text);
tblock.append("tspan")
  .text(line2_text);

Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
        http://www.hebbut.net/
mail:   g...@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------

Nate Bauernfeind

unread,
Jan 5, 2013, 3:28:13 AM1/5/13
to d3...@googlegroups.com
This appears to be working for me. Thanks for the suggestion!
Reply all
Reply to author
Forward
0 new messages