Data Aggregation & Binning

FusionTime lets you build charts with large datasets. However, when a dataset contains too many records, the resulting chart may not help viewers comprehend the data easily. For instance, consider a scenario, where you have to plot 1,000,000 data points in a line, area, or column chart, on a canvas having dimensions of 500 x 400 pixels. In this case, the chart will try to accommodate all the data points within the available pixels, which will make the chart unreadable.

This is where data aggregation comes in handy. By default, FusionTime automatically groups the data for a specific period of time (For example, 2 months), based on the available pixel of the chart canvas. This automatic grouping of data is known as data binning. By default, once the data is grouped, FusionTime applies the average function to aggregate the data and display it in the chart.

Change Default Aggregation

A chart with default data aggregation is shown below:

Loading data for chart…

In the above chart, note that when you hover on the data plots a tooltip appears which shows the data bin for a specific period of time and the average of the values within that data bin. In this case, the data bin is for 10 days. So the chart shows the average sales value for 10 days.

However, you can change the aggregation function from average to any of the following:

These are reserve keywords for aggregation function which are used by FusionTime. You can also apply your custom function, but the name should not be the same as given below.

  • Sum
  • Average
  • Min
  • Max
  • First
  • Last

To change the aggregation function refer to the code below:

new FusionCharts({
  type: "timeseries",
  dataSource: {
    yAxis: [
        plot: {
          value: "XYZ",
          aggregation: "Sum"

In the above code we have:

  • Set the value of the aggregation property as sum under the plot object.

Change Data Binning

The natural hierarchy of time aids in binning smaller units of time into larger units of time. For example, two bins, each of 12hr size can fall into one bin of 1 day (or 24 hours) bin. A user can zoom into 12hr bin and zoom out to 1-day bin.

The time series charts exploit this behavior of time to create data bins. Though it is suggested to follow the smartly suggested bins for each data, an enthusiastic developer can always modify this.

Take a look at the chart shown below:

Loading data for chart…