score:1

Accepted answer

The steps needed to update an axis are:

  1. Update the scale:

    xScale = xScale.domain([a, b]);
    
  2. Update the axis with the new scale:

    domXAxis.call(xAxis.scale(xScale));
    

    This update can also be animated:

    domXAxis.transition()
        .duration(animationDurationMs)
        .call(xAxis.scale(xScale));
    

Related Query