I have a graph in which I show two data sets in it. The user can press a button to switch to another data set. The problem is that the axes do not match, but when I want to update the ticks, instead I just lay on top of the other axis.
http://jsfiddle.net/scottieb/VjHd6/
The key bit is at the end:
vis.selectAll("axis").remove(); vis.append("svg:g") .attr("class", "x axis") .attr("transform", "translate(0, " + (h - margin ) + ")") .call(d3.svg.axis() .scale(x) .tickSize(0) .tickSubdivide(true) .tickFormat(formatCurrency) );
I tried selectAll ("g"). remove (), but this prevents the laying of the next axis. Any ideas?
source share