DC.js,D3.js |如何从postRender中删除动画?

时间:2017-04-20 11:58:26

标签: d3.js dc.js

我使用postRender在几张DC图表中更改某些y轴标签的x位置:

function moveLabels() {

  var obj = d3.selectAll('text.y-axis-label');

  for (var i=0; i<obj[0].length; i++) {
    var t = d3.transform(d3.select(obj[0][i]).attr("transform"));
    var keepY = t.translate[1];
    d3.select(obj[0][i]).attr("transform","translate(18,"+keepY+") rotate(-90)");
  }

}

它工作正常,但有一个动画应用于移动。每次我更改下拉列表并重绘图表时,y轴标签都会滑动。有谁知道怎么摆脱它?我试过了:

d3.select(obj[0][i]).transition().attr("delay","0").attr("transform","translate(18,"+keepY+") rotate(-90)");

d3.select(obj[0][i]).transition().attr("duration","0").attr("transform","translate(18,"+keepY+") rotate(-90)");

0 个答案:

没有答案