[D3] D3 Data Operator

d3.selection.data([values[, key]])

Binding one piece of data

d3.select("p").data([1]);

d3.select("p").data([[1,2,3]]);

d3.select("p").data([function returnThree(){ return 3; }]);

d3.select("p").data([ superwoman = {"gender": "woman", "transportation": "flying"} ]);

Binding two pieces of data

d3.selectAll("p").data([1, 2]);

d3.selectAll("p").data([ [1, 2, 3], [4, 5, 6] ]);

d3.selectAll("p").data([ function(){ return 3; }, function(){ return 4; } ]);

d3.selectAll("p").data([
  superwoman = { "gender": "female", "transportation": "flying" },
  batman = { "gender": "male", "transportation": "batmobile" }
]);

您可在此處留言

avatar

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料

  Subscribe  
Notify of