Search

Inherited Styles

Timeline

Inherit visual properties from base types using baseType.

Inherited Styles
View live example →

Type styles can inherit styles from a base type themselves.

Define the type that a type inherits from in the baseType property.

See also:

import { createTimeline } from "kronograph";
import data from "./data";

const timeline = createTimeline("my-timeline");

timeline.set(data);
timeline.fit();
export default {
  entityTypes: {
    Claim: {
      order: 2,
    },
    Investigated: {
      baseType: "Claim",
      color: "#EA3C53",
      labelColor: "#fc4c63",
    },
    Accepted: {
      baseType: "Claim",
      color: "#1BBC9B",
      labelColor: "#21deb8",
    },
    Claimant: {
      color: "#b2bfd8",
      lineWidth: 10,
      order: 1,
    },
  },
  eventTypes: {
    default: {
      showArrows: true,
    },
    "Not Flagged": {
      baseType: "default",
      color: "#1BBC9B",
      lineWidth: 2,
    },
    Flagged: {
      baseType: "default",
      color: "#EA3C53",
      lineWidth: 6,
    },
  },
  entities: {
    "smith-johnathan-151": {
      label: "John Smith",
      type: "Claimant",
    },
    "west-josephine-126": {
      label: "Josephine West",
      type: "Claimant",
    },
    "roberts-nathaniel-023": {
      label: "Nathan Roberts",
      type: "Claimant",
    },
    "baxter-eleanor-004": {
      label: "Ella Baxter",
      type: "Claimant",
    },
    "Claim MF-1883": {
      type: "Accepted",
    },
    "Claim DO-1748": {
      type: "Accepted",
    },
    "Claim EF-8738": {
      type: "Accepted",
    },
    "Claim PD-9393": {
      type: "Investigated",
    },
    "Claim SL-8745": {
      type: "Investigated",
    },
    "Claim IE-9393": {
      type: "Accepted",
    },
    "Claim GZ-2012": {
      type: "Investigated",
    },
    "Claim SQ-5563": {
      type: "Accepted",
    },
    "Claim FW-1888": {
      type: "Investigated",
    },
  },
  events: {
    "claim 1": {
      entityIds: ["smith-johnathan-151", "Claim MF-1883"],
      type: "Not Flagged",
      time: new Date(2027, 3, 4),
    },
    "claim 2": {
      entityIds: ["baxter-eleanor-004", "Claim SL-8745"],
      type: "Flagged",
      time: new Date(2025, 2, 25),
    },
    "claim 3": {
      entityIds: ["west-josephine-126", "Claim DO-1748"],
      type: "Not Flagged",
      time: new Date(2028, 12, 8),
    },
    "claim 4": {
      entityIds: ["roberts-nathaniel-023", "Claim EF-8738"],
      type: "Not Flagged",
      time: new Date(2025, 6, 13),
    },
    "claim 5": {
      entityIds: ["smith-johnathan-151", "Claim PD-9393"],
      type: "Flagged",
      time: new Date(2027, 10, 16),
    },
    "claim 6": {
      entityIds: ["baxter-eleanor-004", "Claim IE-9393"],
      type: "Not Flagged",
      time: new Date(2028, 2, 25),
    },
    "claim 7": {
      entityIds: ["roberts-nathaniel-023", "Claim GZ-2012"],
      type: "Flagged",
      time: new Date(2027, 4, 11),
    },
    "claim 8": {
      entityIds: ["baxter-eleanor-004", "Claim SQ-5563"],
      type: "Not Flagged",
      time: new Date(2025, 11, 2),
    },
    "claim 9": {
      entityIds: ["west-josephine-126", "Claim FW-1888"],
      type: "Flagged",
      time: new Date(2026, 8, 5),
    },
  },
};
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
  </head>
  <body>
    <div id="my-timeline" style="height: 100vh"></div>
    <script type="module" src="./code.js"></script>
  </body>
</html>
import React from "react";
import { createRoot } from "react-dom/client";
import Timeline from "kronograph/react/Timeline";
import data from "./data";

export const Demo = () => (
  <Timeline
    entityTypes={data.entityTypes}
    eventTypes={data.eventTypes}
    entities={data.entities}
    events={data.events}
  />
);

const root = createRoot(document.getElementById("my-timeline"));
root.render(<Demo />);
export default {
  entityTypes: {
    Claim: {
      order: 2,
    },
    Investigated: {
      baseType: "Claim",
      color: "#EA3C53",
      labelColor: "#fc4c63",
    },
    Accepted: {
      baseType: "Claim",
      color: "#1BBC9B",
      labelColor: "#21deb8",
    },
    Claimant: {
      color: "#b2bfd8",
      lineWidth: 10,
      order: 1,
    },
  },
  eventTypes: {
    default: {
      showArrows: true,
    },
    "Not Flagged": {
      baseType: "default",
      color: "#1BBC9B",
      lineWidth: 2,
    },
    Flagged: {
      baseType: "default",
      color: "#EA3C53",
      lineWidth: 6,
    },
  },
  entities: {
    "smith-johnathan-151": {
      label: "John Smith",
      type: "Claimant",
    },
    "west-josephine-126": {
      label: "Josephine West",
      type: "Claimant",
    },
    "roberts-nathaniel-023": {
      label: "Nathan Roberts",
      type: "Claimant",
    },
    "baxter-eleanor-004": {
      label: "Ella Baxter",
      type: "Claimant",
    },
    "Claim MF-1883": {
      type: "Accepted",
    },
    "Claim DO-1748": {
      type: "Accepted",
    },
    "Claim EF-8738": {
      type: "Accepted",
    },
    "Claim PD-9393": {
      type: "Investigated",
    },
    "Claim SL-8745": {
      type: "Investigated",
    },
    "Claim IE-9393": {
      type: "Accepted",
    },
    "Claim GZ-2012": {
      type: "Investigated",
    },
    "Claim SQ-5563": {
      type: "Accepted",
    },
    "Claim FW-1888": {
      type: "Investigated",
    },
  },
  events: {
    "claim 1": {
      entityIds: ["smith-johnathan-151", "Claim MF-1883"],
      type: "Not Flagged",
      time: new Date(2027, 3, 4),
    },
    "claim 2": {
      entityIds: ["baxter-eleanor-004", "Claim SL-8745"],
      type: "Flagged",
      time: new Date(2025, 2, 25),
    },
    "claim 3": {
      entityIds: ["west-josephine-126", "Claim DO-1748"],
      type: "Not Flagged",
      time: new Date(2028, 12, 8),
    },
    "claim 4": {
      entityIds: ["roberts-nathaniel-023", "Claim EF-8738"],
      type: "Not Flagged",
      time: new Date(2025, 6, 13),
    },
    "claim 5": {
      entityIds: ["smith-johnathan-151", "Claim PD-9393"],
      type: "Flagged",
      time: new Date(2027, 10, 16),
    },
    "claim 6": {
      entityIds: ["baxter-eleanor-004", "Claim IE-9393"],
      type: "Not Flagged",
      time: new Date(2028, 2, 25),
    },
    "claim 7": {
      entityIds: ["roberts-nathaniel-023", "Claim GZ-2012"],
      type: "Flagged",
      time: new Date(2027, 4, 11),
    },
    "claim 8": {
      entityIds: ["baxter-eleanor-004", "Claim SQ-5563"],
      type: "Not Flagged",
      time: new Date(2025, 11, 2),
    },
    "claim 9": {
      entityIds: ["west-josephine-126", "Claim FW-1888"],
      type: "Flagged",
      time: new Date(2026, 8, 5),
    },
  },
};
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
  </head>
  <body>
    <div id="my-timeline" style="height: 100vh"></div>
    <script type="module" src="./code.jsx"></script>
  </body>
</html>

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.