Entities

Entity Styling

Entities run horizontally on the timeline and are shown when they have an associated event in the visible time range.

Customize and style your entities with the properties in the Entity object. Here the first entity has all the default properties and the second entity has some custom properties set:

const entities = {
  'Default Entity Style': {},
  'Custom Entity Style': {
    color: '#c9477b',
    lineWidth: 5,
    labelColor: '#ffd88f',
    glyph: true,
    fadeOutsideRange: true,
  },
},

Try out some of the properties in the Styling Entities story.

Entity Types

If you have a number of entities that you want to customize in the same way, use the EntityType object and then assign a type to the Entity. Each entity can only have one type.

In these examples, we are using a subset of the "Bigfoot Sightings" data from the Bigfoot Field Researchers Organization (BFRO). Here, the numbered sightings are organized into types by State. Each State has its own EntityType where the entity color is set.

There is an assigned order for the California and Colorado entity types. The order property allows you to control the sequence of entity types on the timeline.

This is an example of how the entityTypes are shown in the data:

const entityTypes = {
  "California": {
    "color": "#e9d8a6",
    "order": 1
  },
  "Connecticut": {
    "color": "#94d2bd"
  },
  "Colorado": {
    "color": "#EE9B00",
    "order": 0
  }
}

This is how the entityTypes are assigned to the entities using the type property:

const entities = {
  "7211": {
    "type": "California"
  },
}

See types in use in the Styling Items by Type story.

Entity Base Types

Entity types can inherit properties from a baseType. In this example, each entity has a type based on its classification. "Class A" and "Class B" set the labelColor and the entity color is inherited from the "California" entity type.

const entities = {
  "7555": {
    "type": "Class A"
  }
}
const entityTypes = {
  "California": {
    "color": "#62b6cb",
  },
  "Class B": {
    "labelColor": "#f9c74f",
    "baseType": "California"
  },
  "Class A": {
    "labelColor": "#90be6d",
    "baseType": "California"
  },
  "Class C": {
    "baseType": "California"
  }
}

See the Inherited Styles story for more details.

Default Entity Type

It's possible to specify entity properties using the default entity type:

  const entityTypes = {
    default: {
      color: '#EE9B00',
      lineWidth: 5,
      labelColor: '#EE9B00',
    },
  },

Any entity that doesn't have these properties set will inherit them from the default entity type.

Note the default type cannot have a baseType.

Entity Groups

Further organize entities in the timeline using groupBy to create as many nested levels as needed. Here all the entities have the type as "State" and are grouped by "season" and "classification".

The groupBy property is set within the entityType:

const entityTypes = {
  "California": {
    "color": "#e9d8a6",
    "groupBy": [
      "season",
      "classification"
    ]
  },
}

The "season" and "classification" are set within the data object for each entity:

const entities = {
  "14338": {
    "data": {
      "season": "Fall",
      "classification": "Class A"
    },
    "type": "California"
  },
}

For more details on groups, see the Groups story.

Glyphs

Glyphs are circles displayed alongside entity and entity type labels. They're especially useful for adding extra meaning to your labels or for highlighting certain entities or entity types. You can also style them with custom colors or font icons.

Use the following APIs to add glyphs to your timeline:

const entityTypes: {
  Customer: {
    typeGlyph: {
      color: '#943651',
      fontIcon: {
        fontFamily: 'Font Awesome 6 Free',
        fontWeight: 100,
        text: '\u{f256}',
      },
    },
  },
  'Sales Person': {
    glyph: {
      color: '#FFCD00',
      fontIcon: {
        fontFamily: 'Font Awesome 6 Free',
        fontWeight: 900,
        text: '\u{f53a}',
      },
    },
  },
},
const entities: {
  'smith-johnathan-151': {
    label: 'John Smith',
    type: 'Customer',
    color: '#E32F42',
  },
  'west-josephine-126': {
    label: 'Josephine West',
    color: '#FF7A4F',
    glyph: true,
    type: 'Customer',
  },
  'roberts-nathaniel-023': {
    label: 'Nathan Roberts',
    color: '#00AFB9',
    type: 'Sales Person',
  },
  'baxter-eleanor-004': {
    label: 'Ella Baxter',
    color: '#0077B6',
    type: 'Sales Person',
  },
},

Glyphs inherit the color of the entity or entity type that they are applied to unless you assign a color via the Glyph object.

The position of glyphs in relation to the entity label or entity type label is controlled globally via the glyphPosition option.

For more ideas take a look at the Styling Glyphs story.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.