javascript - What does binding to Object do in D3.js -


i trying understand d3.js code this example , confused code:

var circle = interpolation.selectall("circle")     .data(object); circle.enter().append("circle")     .attr("r", 4)     .attr("fill","yellow"); circle     .attr("cx", function y(d) { console.log(d.attr("class")); return d.x; })     .attr("cy", function(d) { return d.y; }); 

what second line of code do? data bind to?

the data bound in element above given function getlevels(d, t), d number of range 2 - 4 , t number derived current time.

this ever returns array of arrays. because array already of type object, calling object() on array returns original array.. therefore, can see, author using object kind of identity function, similar to:

var identity = function(d){   return d; }  var circle = interpolation.selectall("circle")     .data(identity); circle.enter().append("circle")     .attr("r", 4)     .attr("fill","yellow"); circle     .attr("cx", function y(d) { console.log(d.attr("class")); return d.x; })     .attr("cy", function(d) { return d.y; }); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -