DHTMLX Docs & Samples Explorer

group ()

Required library edition: This method works with any edition of DHTMLX library

Required library file: dhtmlxchart.js

The method groups data by a certain property. The method get an object with the following properties as a parameter:

  • by – defines the property that need being used to group data objects,
  • map – an object that defines the properties of the grouped objects.

Properties of grouped objects set in “map” are defined by an array. The first element of this array is a template with a property from original data, the second one – the functor which needs being applied to all values of this property in a group: “sum”, “max”, “min” or custom function

    chart.group({
      by:"#company#",
      map:{
	sales:["#sales#","sum"]
      }
    });