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>