I'd probably use svg:tspan elements for that, even if it is a bit tedious:
var text = svg.append("svg:text");
text.append("svg:tspan").style("fill", "red").text("hello");
text.append("svg:tspan").style("fill", "blue").text("world");
But, you do have other options. You could use an absolute-positioned
HTML overlay. Or an svg:foreignObject element:
svg.append("svg:foreignObject")
.attr("width", 200)
.attr("height", 200);
.append("div")
.html("<span style='color:red'>Hello</span> <span
style='color:blue'>world</span>!");
Mike
I'm so proud of using D3 !
Guan-Cheng
--
You received this message because you are subscribed to a topic in the Google Groups "d3-js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/d3-js/d2ceKITfTx0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.