我正在尝试使用 d3js.org 提供的 Donut3D.js。但是,我对下面的行感到困惑
Donut3D.transition("salesDonut", randomData(), 130, 100, 30, 0.4);
最后的数字代表什么?
130, 100, 30, 0.4
我没有看到任何相关文档?有人可以帮助我理解那些正在传递的数字吗?
var salesData=[
{label:"Used", color:"#FF3300"},
{label:"Free", color:"#00FF00"}
];
var svg = d3.select("body").append("svg").attr("width",700).attr("height",300);
svg.append("g").attr("id","salesDonut");
Donut3D.draw("salesDonut", randomData(), 150, 150, 130, 100, 30, 0.4);
function changeData(){
Donut3D.transition("salesDonut", randomData(), 130, 100, 30, 0.4);
}
function randomData(){
return salesData.map(function(d){
return {label:d.label, value:1000*Math.random(), color:d.color};});
}
</script>
最佳答案
Donut3D 定义及其绘制方法就在页面中
Donut3D.draw=function(id, data, x /*center x*/, y/*center y*/,
rx/*radius x*/, ry/*radius y*/, h/*height*/, ir/*inner radius*/)
在那里你可以看到每个值代表什么
关于javascript - 试图了解 javascript d3js 框架中的转换方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24560890/