D3.js: ?

D3.js , streamgraphs. :

enter image description here

... , .

:

var area = d3.svg.area()
   .x(function(d) { console.log('x', d.data); return d.x * w / mx; })
   .y0(function(d) { return h - d.y0 * h / my; })
   .y1(function(d) { return h - (d.y + d.y0) * h / my; });
vis.selectAll("path")
 .data(data0) 
 .enter().append("path")
 .style("fill", function() { return color(Math.random()); })
 .attr("d", area);

      

, , data0

( ) , :

vis.selectAll("path")
 .data(data0, function(d) { return d.name }) // Add key function
 .enter().append("path")
 .style("fill", function() { return color(Math.random()); })
 .attr("d", area)
 .on("mouseover", function (d,i) { 
     console.log("mouseover", d.name); // Log name property on mouseover
  });

      

, - data0

, . name

data0

area

.data()

?

UPDATE: : D3 docs , . , data0

, , name

data

, , , area

?

+3




2


"name", . , , / , .. , ( ). .data()

, . , , , , .



+6




, , " ", , , .

, , , .



mouseover mouseout, , .

, .

0









All Articles