.transition()打破了我的差异图表

时间:2013-02-03 18:11:44

标签: d3.js transition

出于某种原因,添加转换会破坏我的两个clipPath。这非常有效:

// Append path first
var svg = d3.select(this).selectAll("svg").data([data]);
var gEnter = svg.enter().append("svg").append("g");
gEnter.append("clipPath").attr("class", "above").attr("id", "clip-above").append("path");
gEnter.append("clipPath").attr("class", "below").attr("id", "clip-below").append("path");

// Later, attach data
var g = svg.select("g")
g.select("#clip-above path").attr("d", area.y0(0));
g.select("#clip-below path").attr("d", area.y0(height));

但是,如果我添加转换,整个区域只会被area-below

着色
// Later, attach data
var g = svg.select("g")
g.select("#clip-above path").transition().duration(500).attr("d", area.y0(0));
g.select("#clip-below path").transition().duration(500).attr("d", area.y0(height));

知道发生了什么事吗?

1 个答案:

答案 0 :(得分:0)

这是d3.v2中的错误。务必更新!