Add emojis to your timeline using the fontIcon object within the glyphs object.
See also:
import { createTimeline } from "kronograph";
import { entities, events } from "./data";
const timeline = createTimeline("my-timeline");
timeline.set({
entities,
events,
});
timeline.fit(); const transparent = "rgba(0, 0, 0, 0)";
const entityFontIconScale = 2;
const flagEmojis = {
UK: "π¬π§",
USA: "πΊπΈ",
Spain: "πͺπΈ",
Japan: "π―π΅",
Brazil: "π§π·",
};
export const entities = {
UK: {
label: "United Kingdom",
color: "#15cad5",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.UK,
scale: entityFontIconScale,
},
},
},
USA: {
label: "United States",
color: "#e12d39",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.USA,
scale: entityFontIconScale,
},
},
},
Spain: {
label: "Spain",
color: "#f7d06e",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.Spain,
scale: entityFontIconScale,
},
},
},
Japan: {
label: "Japan",
color: "#f9f9f9",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.Japan,
scale: entityFontIconScale,
},
},
},
Brazil: {
label: "Brazil",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.Brazil,
scale: entityFontIconScale,
},
},
},
};
export const events = {
event1: {
entityIds: ["UK", "USA"],
time: new Date(2025, 7, 14, 8, 49),
},
event2: {
entityIds: ["UK", "Japan"],
time: new Date(2025, 7, 14, 8, 56),
},
event3: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 9, 2),
},
event4: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 9, 27),
},
event5: {
entityIds: ["Japan", "USA"],
time: new Date(2025, 7, 14, 10, 20),
},
event6: {
entityIds: ["USA", "UK"],
time: new Date(2025, 7, 14, 10, 30),
},
event7: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 10, 34),
},
event8: {
entityIds: ["Brazil", "Japan"],
time: new Date(2025, 7, 14, 11, 40),
},
event9: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 10, 51),
},
event10: {
entityIds: ["Spain", "UK"],
time: new Date(2025, 7, 14, 12, 5),
},
event11: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 14, 37),
},
event12: {
entityIds: ["Japan", "Spain"],
time: new Date(2025, 7, 14, 16, 7),
},
event13: {
entityIds: ["Spain", "USA"],
time: new Date(2025, 7, 14, 17, 42),
},
event14: {
entityIds: ["UK", "Brazil"],
time: new Date(2025, 7, 14, 13, 17),
},
event15: {
entityIds: ["Brazil", "Spain"],
time: new Date(2025, 7, 14, 15, 7),
},
event16: {
entityIds: ["Brazil", "USA"],
time: new Date(2025, 7, 14, 17, 8),
},
}; <!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 { entities, events } from "./data";
export const Demo = () => <Timeline entities={entities} events={events} />;
const root = createRoot(document.getElementById("my-timeline"));
root.render(<Demo />); const transparent = "rgba(0, 0, 0, 0)";
const entityFontIconScale = 2;
const flagEmojis = {
UK: "π¬π§",
USA: "πΊπΈ",
Spain: "πͺπΈ",
Japan: "π―π΅",
Brazil: "π§π·",
};
export const entities = {
UK: {
label: "United Kingdom",
color: "#15cad5",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.UK,
scale: entityFontIconScale,
},
},
},
USA: {
label: "United States",
color: "#e12d39",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.USA,
scale: entityFontIconScale,
},
},
},
Spain: {
label: "Spain",
color: "#f7d06e",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.Spain,
scale: entityFontIconScale,
},
},
},
Japan: {
label: "Japan",
color: "#f9f9f9",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.Japan,
scale: entityFontIconScale,
},
},
},
Brazil: {
label: "Brazil",
glyph: {
color: transparent,
fontIcon: {
fontFamily: "sans-serif",
text: flagEmojis.Brazil,
scale: entityFontIconScale,
},
},
},
};
export const events = {
event1: {
entityIds: ["UK", "USA"],
time: new Date(2025, 7, 14, 8, 49),
},
event2: {
entityIds: ["UK", "Japan"],
time: new Date(2025, 7, 14, 8, 56),
},
event3: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 9, 2),
},
event4: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 9, 27),
},
event5: {
entityIds: ["Japan", "USA"],
time: new Date(2025, 7, 14, 10, 20),
},
event6: {
entityIds: ["USA", "UK"],
time: new Date(2025, 7, 14, 10, 30),
},
event7: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 10, 34),
},
event8: {
entityIds: ["Brazil", "Japan"],
time: new Date(2025, 7, 14, 11, 40),
},
event9: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 10, 51),
},
event10: {
entityIds: ["Spain", "UK"],
time: new Date(2025, 7, 14, 12, 5),
},
event11: {
entityIds: ["UK", "Spain"],
time: new Date(2025, 7, 14, 14, 37),
},
event12: {
entityIds: ["Japan", "Spain"],
time: new Date(2025, 7, 14, 16, 7),
},
event13: {
entityIds: ["Spain", "USA"],
time: new Date(2025, 7, 14, 17, 42),
},
event14: {
entityIds: ["UK", "Brazil"],
time: new Date(2025, 7, 14, 13, 17),
},
event15: {
entityIds: ["Brazil", "Spain"],
time: new Date(2025, 7, 14, 15, 7),
},
event16: {
entityIds: ["Brazil", "USA"],
time: new Date(2025, 7, 14, 17, 8),
},
}; <!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>