I have a simple D3 scatterplot that I switch among displaying several different attributes of my data, but while I can get the data points to change (and to transition as I want them to), and can change the labels to the figure's axes, I cannot get the axes themselves to update (let alone transition).
I suspect I'm doing something in the wrong order, or am missing a step, but I can't figure out from the documentation or examples I'm working from what I'm missing.
How do I get my axes to update along with my data?
The mystery arises from the behavior at the end of the linked code:
d3.select("#distancefig").on("click", function () {
d3.event.preventDefault();
updatePlot('distancefig', false);
});
d3.select("#speedfig").on("click", function () {
d3.event.preventDefault();
updatePlot('speedfig', false);
});
d3.select("#distspeedfig").on("click", function () {
d3.event.preventDefault();
updatePlot('distspeedfig', false);
});
updatePlot('distancefig', true);
Here the final, explicit updatePlot
updates everything as expected (and changing the argument changes everything — axes, labels, points — as it should), but the calls invoked by clicking on the links change only the data points and labels; they do not update the axes.