RE: d3.js axes update per user selection

I’m seeking an example of updating x-axis date grain and y-axis values per user-selected date grain. So imagine a bar graph, for example, with a date grain toggle for day|month, and a default display with the bars aggregated for day. If the user then selects “month”, the x date axis re-formats to month-year (or 01/MM/YYYY, whatever) and the bars and y axis adjust to fit the increased values when (re)summed at that date grain. Seems like an easy thing to google but striking out so far. Appreciate any examples.

It should be possible to change the axis format with tickFormat.