Skip to content

Instantly share code, notes, and snippets.

@scameron
Created July 20, 2012 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scameron/3148920 to your computer and use it in GitHub Desktop.
Save scameron/3148920 to your computer and use it in GitHub Desktop.
textPath Chrome bug
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<title>Test</title>
<body>
<div class="sample"></div>
</body>
<script type="text/javascript">
var group = d3.select(".sample").append("svg")
.attr("width", 500)
.attr("height", 500)
.append("g")
.attr("transform", "translate(250, 250)");
group.append("defs").append("path")
.attr("id", "mypath")
.style("fill", "#3182bd")
.style("stroke", function(d) { return d3.rgb("#3182bd").darker(); })
.transition().duration(500)
.attrTween("d", function() {
var i = d3.interpolateObject(
{startAngle: 0, endAngle: 0},
{startAngle: 0, endAngle: 1.5237959250725985}
);
return function(t) {
return d3.svg.arc()
.innerRadius(200)
.outerRadius(220)(i(t));
};
})
group.append("use").attr("xlink:href", "#mypath");
group.append("text")
.attr("dx", 10)
.attr("dy", 14)
.append("textPath")
.attr("xlink:href", "#mypath")
.text("My Path Text");
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment