objectCategory

Type: function(object, categories, defaultCategory, extraConfig)
Default: not implemented

The objectCategory function allows the default category of an object to be overridden. It takes a number of parameters:

  • object: the current object
  • categories: all categories of the chart. This object has a method called categories.get(categoryKeyOrLabel), which takes a category key or label as a parameter, and which returns a category object based on that input.
  • defaultCategory: this is either the category assigned to the object, or if it's not set, the category assigned to the section of the object.
  • extraConfig: see extraConfig

objectCategory must return a category object, either one retrieved from categories, or the defaultCategory.

objectCategory: function(object, categories, defaultCategory, extraConfig) {
if(object.label === 'A-1') {
return categories.get('Stalls');
}
return defaultCategory;
}