I am trying to re-use this Bostock's d3 code example of a negative stacked bar chart: https://bl.ocks.org/mbostock/b5935342c6d21928111928401e2c8608 .
Using my own data source, I want alter this code to have a date grain toggle to alternate between day and month x-axis date grains, and trigger a corresponding re-aggregation of the y-axis values.
My question: what is the right mechanism to use to do the replacement of date grain and re-aggregation nowadays? Is it merge? Join? Update? ... not sure what to google. Thanks for any advice.