Skip to main content

objectColor

Type: function(object, defaultColor, extraConfig)

By default, color will be grey if the object is not available for selection, or the category color otherwise.

A function that determines the object color. Can be based on object.status, object.category, object.selectable or on other criteria.

By default, selectable objects are shown in their category color, and other objects are rendered grey.

Your implementation of objectColor must return a CSS string (e.g. 'red' or '#ccc').

The parameters that are passed to objectColor are:

  • object: The current object.
  • defaultColor: The default object color.
  • extraConfig: Variables and data from your application. See extraConfig.
Accessing your application variables

This function is called inside the Seats.io iFrame and cannot access variables defined in the scope of your application. To do so, pass them first through the extraConfig configuration parameter.

Warning

This function is called for each object on the chart; make sure it's fast, or chart rendering times will suffer. Avoid using slow methods such as Array.indexOf. Read more here.