出于某种原因,添加转换会破坏我的两个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));
知道发生了什么事吗?
答案 0 :(得分:0)
这是d3.v2
中的错误。务必更新!