Animation 使用d3.js设置表格行重排序动画

Animation 使用d3.js设置表格行重排序动画,animation,d3.js,Animation,D3.js,我希望对表的数据重新排序,并平滑地设置表的行交换动画 有关代码,请访问 我可能错了,但我很确定,涉及行移动的动画很难用实际的表元素来完成-行顺序由插入顺序定义,因此d3没有位置信息进行插值。 var table = d3.select("body").select("table#d3table"); var tHead = table.append("thead"); tHead.append("tr"); tHead.selectAll("th").data(thead).enter().a

我希望对表的数据重新排序,并平滑地设置表的行交换动画

有关代码,请访问


我可能错了,但我很确定,涉及行移动的动画很难用实际的
元素来完成-行顺序由插入顺序定义,因此d3没有位置信息进行插值。
var table = d3.select("body").select("table#d3table");
var tHead = table.append("thead");
tHead.append("tr");
tHead.selectAll("th").data(thead).enter().append("th").text(function(d) {return d.id});
var tBody = table.append("tbody");
var tr = tBody.selectAll("tr").data(tbody).enter().append("tr");
tr.selectAll("td")
    .data(function(d){return d.row})
    .enter()
        .append("td")
        .text(function(d){return d.value + d.id})

// Some magick row position manipulation