我有一个包含大量数据的图表,这意味着我在x轴上有一个滚动条。 当我滚动X轴时,Y轴消失。
我可以设置Y轴位置固定。 (总是看到这个Y轴)?
https://jsfiddle.net/ou28se1z/1/
我尝试添加//Add Y axis
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + padding + ",0)")
.attr("position", "fixed")
.call(yAxis);
,但它不起作用
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + padding + ",0)")
.style("position", "fixed")
.call(yAxis);
我也尝试过.style(“position”,“fixed”)
<button>
但它不起作用
答案 0 :(得分:0)
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) + ")"; }
);
}