Dynamically changing data granularity on a Serial chart

This demo demonstrates how to dynamically change granularity of data of the Serial chart. It enables to switch between monthly data (source data) and yearly (aggregated).

When user selects a granularity via dropdown, a custom code kicks in which:

  1. Takes either source data (monthly) or uses custom function to aggregate yearly data; (taking the last data point in each month)
  2. Updates chart's dataProvider;
  3. Sets proper granularity in category axis minPeriod;
  4. Sets proper format for cursor's category axis balloon via categoryBalloonDateFormat;
  5. Calls chart's method validateData() so the chart takes in new data.

The chart also has zoomOutOnDataUpdate set to true so that zoom selection is preserved across data set switches.