admin管理员组文章数量:1400336
In the following D3 sunburst :
/
.attr("transform", function(d) {
return "rotate(" + (d.x + d.dx / 2 - Math.PI / 2) / Math.PI * 180 + ")";
});
The labels in the left quadrants are upside down, I would like to perform a rotation on them so that the text reads from left to right.
The transformation should only apply to the arcs from approximately 100 degree to 270 degree.
In the following D3 sunburst :
http://jsfiddle/maxl/eabFC/
.attr("transform", function(d) {
return "rotate(" + (d.x + d.dx / 2 - Math.PI / 2) / Math.PI * 180 + ")";
});
The labels in the left quadrants are upside down, I would like to perform a rotation on them so that the text reads from left to right.
The transformation should only apply to the arcs from approximately 100 degree to 270 degree.
Share Improve this question edited Jul 3, 2014 at 11:11 VividD 10.5k8 gold badges66 silver badges112 bronze badges asked Dec 19, 2012 at 18:40 BoutranBoutran 10.1k16 gold badges59 silver badges86 bronze badges 1-
A suggestion I would offer, which does not follow directly with your question, is to not have the labels attached to the arcs, but rather provide a key off to one side and/or tooltip rollovers (using
tipsy.js
, for example). It will decrease the visual clutter and provide better visual parsing of the graph. – Nicholas Pappas Commented Dec 20, 2012 at 16:30
1 Answer
Reset to default 6Following this example: http://www.jasondavies./coffee-wheel/
I've edited your jsfiddle here: http://tributary.io/inlet/4127332/
You are going to have to deal with your long labels and the above example shows how to do multi-line.
Also note that you are using an old version of d3, it is no longer necessary to call d3.layout separately. Here is the link to new shiny version of d3:
<script src="http://d3js/d3.v3.js"></script>
本文标签: javascriptHow to properly rotate text labels in a D3 sunburst diagramStack Overflow
版权声明:本文标题:javascript - How to properly rotate text labels in a D3 sunburst diagram - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744157394a2593172.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论