Reputation: 2555
I have a chart with alot of data that means I have a scroller over the x axis. when I scroll over the X axis Y axis disappear.
can i set to Y axis position fixed. ( always see this Y axis)?
https://jsfiddle.net/ou28se1z/1/
I tried to add .attr("position", "fixed")
but it doesnt work
//Add Y axis
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + padding + ",0)")
.attr("position", "fixed")
.call(yAxis);
I also tried to do .style("position", "fixed")
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + padding + ",0)")
.style("position", "fixed")
.call(yAxis);
but its not work
Upvotes: 2
Views: 1332
Reputation: 2555
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) + ")"; }
);
}
Upvotes: 1