2014-07-03 70 views
0

我想使用d3js.org提供的Donut3D.js。然而,我很困惑下面的線試圖瞭解javascript d3js框架中的過渡方法?

Donut3D.transition(「salesDonut」,randomData(),130,100,30,4.4);

thoes end number代表什麼?

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> 

http://bl.ocks.org/NPashaP/9994181

+1

如果你需要它,這是一個堅實的解釋.transition()http://alignedleft.com/projects/2014/easy-as-pi/ –

+0

感謝您的鏈接非常有幫助 –

回答

2

Donut3D定義是正確的,在該頁面及其繪製方法以及

Donut3D.draw=function(id, data, x /*center x*/, y/*center y*/, 
     rx/*radius x*/, ry/*radius y*/, h/*height*/, ir/*inner radius*/) 

那裏,你可以看到每個值代表