[英]d3 make Y axis position fixed even the scroller x
我有一個包含大量數據的圖表,這意味着我在 x 軸上有一個滾動條。 當我在 X 軸上滾動時,Y 軸消失。
我可以設置為固定的 Y 軸位置嗎? (總是看到這個 Y 軸)?
https://jsfiddle.net/ou28se1z/1/我試圖添加.attr("position", "fixed")
但它不起作用
//Add Y axis
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + padding + ",0)")
.attr("position", "fixed")
.call(yAxis);
我也試過 do.style("position", "fixed")
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + padding + ",0)")
.style("position", "fixed")
.call(yAxis);
但它不起作用
http://codepen.io/brantwills/pen/igsoc
var zoom = d3.behavior.zoom()
.x(x)
.y(y)
.scaleExtent([1, 10])
.on("zoom", zoomed);
function zoomed() {
svg.select(".x.axis").call(xAxis);
svg.select(".y.axis").call(yAxis);
svg.selectAll('path.line').attr('d', line);
points.selectAll('circle').attr("transform", function(d) {
return "translate(" + x(d.point.x) + "," + y(d.point.y) + ")"; }
);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.