LoginSignup
0
0

More than 5 years have passed since last update.

D3使用技巧

Posted at

合并数组,排序数组

    var result2=[{Date: "2017-09-27 22:03:00", Open: "111", High: "1111", Low: "1111"},{Date: "2017-09-27 22:02:00", Open: "27510", High: "27510", Low: "27504"}];
    var result=[{Date: "2017-09-27 23:03:00", Open: "111", High: "1111", Low: "1111"},{Date: "2017-09-27 23:02:00", Open: "27510", High: "27510", Low: "27504"}];
    var t=new Array();
    t.push(result);
    t.push(result2);
    var result=d3.merge(t);
    var nest=d3.nest().key(function(d){return d.Date}).sortKeys(d3.ascending).entries(result);
    var r=new Array();
    for(var i=0;i<nest.length;i++)
    {
    r.push(nest[i].values[0]);
    }
    console.log(r);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0