Use the controls below the timeline to customize the heatmap.
Specifying a custom value and direction can give insights into your data beyond the default event count.
See the Heatmap Colors story to see how custom values can be used to control the colors used for the heatmap.
See also:
import { createTimeline } from "kronograph";
import data from "./data";
const timeline = createTimeline("my-timeline");
const timelineOptions = {
events: {
heatmapThreshold: 20,
heatmapValue: null,
heatmapDirection: "any",
},
};
timeline.options(timelineOptions);
timeline.set(data);
timeline.fit();
function handleSelectOption(id, setOptionFn) {
document.getElementById(id).addEventListener("change", (e) => {
const { value } = e.target;
// Update the timelineOptions object with the user's selection and pass it to the Timeline's options function
setOptionFn(value);
timeline.options(timelineOptions);
});
}
handleSelectOption("heatmap-value-select", (value) => {
timelineOptions.events.heatmapValue = value === "events" ? null : "amount";
});
handleSelectOption("heatmap-direction-select", (value) => {
timelineOptions.events.heatmapDirection = value;
}); export default {
entities: {
"Aurora Bancorp": {
color: "#4e79a7",
},
"Better Life Bank": {
color: "#f28e2c",
},
"Ace Financial Group": {
color: "#e15759",
},
"Grand Mutual Bank": {
color: "#76b7b2",
},
"Felicity Financial Services": {
color: "#59a14f",
},
},
events: {
event0: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 103,
},
time: 1716845042401.983,
},
event1: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1522,
},
time: 1704300247970.444,
},
event2: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 2519,
},
time: 1704826361998.4548,
},
event3: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1744,
},
time: 1721561387584.9785,
},
event4: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1292,
},
time: 1721436187577.0662,
},
event5: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1913,
},
time: 1715184891178.0125,
},
event6: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1379,
},
time: 1720022197785.7358,
},
event7: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 2108,
},
time: 1713047293850.0168,
},
event8: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 39987,
},
time: 1719556922296.1238,
},
event9: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 6269,
},
time: 1717726178569.1255,
},
event10: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 4629,
},
time: 1718167137411.861,
},
event11: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 4112,
},
time: 1719690540773.6128,
},
event12: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 44477,
},
time: 1718653783292.392,
},
event13: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 86674,
},
time: 1719055763972.7158,
},
event14: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 96953,
},
time: 1718812764374.0154,
},
event15: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 57831,
},
time: 1717355969771.8218,
},
event16: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 1992,
},
time: 1721029217990.7224,
},
event17: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 471,
},
time: 1722545977814.828,
},
event18: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 2274,
},
time: 1712785338304.0298,
},
event19: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 3067,
},
time: 1706715885813.1304,
},
event20: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 670,
},
time: 1705034721408.0198,
},
event21: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 648,
},
time: 1719489884462.4038,
},
event22: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 325,
},
time: 1721614571235.6663,
},
event23: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 851,
},
time: 1705237236251.1895,
},
event24: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 3121,
},
time: 1721380170448.32,
},
event25: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1778,
},
time: 1719476838892.334,
},
event26: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 3781,
},
time: 1714459016034.4941,
},
event27: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1165,
},
time: 1713136401986.9214,
},
event28: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 2237,
},
time: 1712559528845.578,
},
event29: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1535,
},
time: 1720931783679.7734,
},
event30: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1622,
},
time: 1721528143853.7964,
},
event31: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 523,
},
time: 1709514478039.349,
},
event32: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1257,
},
time: 1715409427247.5706,
},
event33: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 736,
},
time: 1707482336867.2246,
},
event34: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 184,
},
time: 1725199319145.929,
},
event35: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1058,
},
time: 1713232568113.0273,
},
event36: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1429,
},
time: 1721868788309.195,
},
event37: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1197,
},
time: 1707839323010.2188,
},
event38: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 2522,
},
time: 1717712034817.7363,
},
event39: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 3094,
},
time: 1724919209625.5513,
},
event40: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1121,
},
time: 1718493292818.4546,
},
event41: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 2878,
},
time: 1714709244615.406,
},
event42: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1504,
},
time: 1715372672224.4255,
},
event43: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 320,
},
time: 1710331215554.826,
},
event44: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1906,
},
time: 1710184345462.6362,
},
event45: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1246,
},
time: 1725198486655.9883,
},
event46: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1476,
},
time: 1706451804586.463,
},
event47: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 192,
},
time: 1723811742494.3857,
},
},
eventTypes: {
default: {
lineWidth: 2,
color: "#00a2ed",
},
},
}; <!doctype html>
<html>
<head>
<link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
</head>
<body>
<div class="story">
<div class="story__timeline" id="my-timeline"></div>
<div class="story__controls story__controls--row">
<div class="story__controls__item">
<label for="heatmap-value-select">Heatmap Value</label>
<select id="heatmap-value-select" class="select">
<option value="events" selected>Event Count</option>
<option value="amount">Amount</option>
</select>
</div>
<div class="story__controls__item">
<label for="heatmap-direction-select">Heatmap Direction</label>
<select id="heatmap-direction-select" class="select">
<option value="any" selected>Any</option>
<option value="from">From</option>
<option value="to">To</option>
</select>
</div>
</div>
</div>
<script type="module" src="./code.js"></script>
</body>
</html> import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import Timeline from "kronograph/react/Timeline";
import data from "./data";
export const Demo = () => {
const [heatmapValue, setHeatmapValue] = useState(null);
const [heatmapDirection, setHeatmapDirection] = useState("any");
const options = {
events: { heatmapValue, heatmapDirection, heatmapThreshold: 20 },
};
return (
<div className="story">
<Timeline
className="story__timeline"
entities={data.entities}
events={data.events}
eventTypes={data.eventTypes}
options={options}
/>
<div className="story__controls story__controls--row">
<div className="story__controls__item">
<label htmlFor="heatmap-value-select">Heatmap Value</label>
<select
id="heatmap-value-select"
className="select"
defaultValue="events"
onChange={(e) => {
setHeatmapValue(e.target.value === "events" ? null : "amount");
}}
>
<option value="events">Event Count</option>
<option value="amount">Amount</option>
</select>
</div>
<div className="story__controls__item">
<label htmlFor="heatmap-direction-select">Heatmap Direction</label>
<select
id="heatmap-direction-select"
className="select"
defaultValue="any"
onChange={(e) => {
setHeatmapDirection(e.target.value);
}}
>
<option value="any">Any</option>
<option value="from">From</option>
<option value="to">To</option>
</select>
</div>
</div>
</div>
);
};
const root = createRoot(document.getElementById("my-timeline"));
root.render(<Demo />); export default {
entities: {
"Aurora Bancorp": {
color: "#4e79a7",
},
"Better Life Bank": {
color: "#f28e2c",
},
"Ace Financial Group": {
color: "#e15759",
},
"Grand Mutual Bank": {
color: "#76b7b2",
},
"Felicity Financial Services": {
color: "#59a14f",
},
},
events: {
event0: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 103,
},
time: 1716845042401.983,
},
event1: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1522,
},
time: 1704300247970.444,
},
event2: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 2519,
},
time: 1704826361998.4548,
},
event3: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1744,
},
time: 1721561387584.9785,
},
event4: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1292,
},
time: 1721436187577.0662,
},
event5: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1913,
},
time: 1715184891178.0125,
},
event6: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 1379,
},
time: 1720022197785.7358,
},
event7: {
entityIds: {
from: "Aurora Bancorp",
to: "Better Life Bank",
},
data: {
amount: 2108,
},
time: 1713047293850.0168,
},
event8: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 39987,
},
time: 1719556922296.1238,
},
event9: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 6269,
},
time: 1717726178569.1255,
},
event10: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 4629,
},
time: 1718167137411.861,
},
event11: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 4112,
},
time: 1719690540773.6128,
},
event12: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 44477,
},
time: 1718653783292.392,
},
event13: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 86674,
},
time: 1719055763972.7158,
},
event14: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 96953,
},
time: 1718812764374.0154,
},
event15: {
entityIds: {
from: "Aurora Bancorp",
to: "Felicity Financial Services",
},
data: {
amount: 57831,
},
time: 1717355969771.8218,
},
event16: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 1992,
},
time: 1721029217990.7224,
},
event17: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 471,
},
time: 1722545977814.828,
},
event18: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 2274,
},
time: 1712785338304.0298,
},
event19: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 3067,
},
time: 1706715885813.1304,
},
event20: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 670,
},
time: 1705034721408.0198,
},
event21: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 648,
},
time: 1719489884462.4038,
},
event22: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 325,
},
time: 1721614571235.6663,
},
event23: {
entityIds: {
from: "Aurora Bancorp",
to: "Ace Financial Group",
},
data: {
amount: 851,
},
time: 1705237236251.1895,
},
event24: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 3121,
},
time: 1721380170448.32,
},
event25: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1778,
},
time: 1719476838892.334,
},
event26: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 3781,
},
time: 1714459016034.4941,
},
event27: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1165,
},
time: 1713136401986.9214,
},
event28: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 2237,
},
time: 1712559528845.578,
},
event29: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1535,
},
time: 1720931783679.7734,
},
event30: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 1622,
},
time: 1721528143853.7964,
},
event31: {
entityIds: {
from: "Aurora Bancorp",
to: "Grand Mutual Bank",
},
data: {
amount: 523,
},
time: 1709514478039.349,
},
event32: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1257,
},
time: 1715409427247.5706,
},
event33: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 736,
},
time: 1707482336867.2246,
},
event34: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 184,
},
time: 1725199319145.929,
},
event35: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1058,
},
time: 1713232568113.0273,
},
event36: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1429,
},
time: 1721868788309.195,
},
event37: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 1197,
},
time: 1707839323010.2188,
},
event38: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 2522,
},
time: 1717712034817.7363,
},
event39: {
entityIds: {
from: "Better Life Bank",
to: "Felicity Financial Services",
},
data: {
amount: 3094,
},
time: 1724919209625.5513,
},
event40: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1121,
},
time: 1718493292818.4546,
},
event41: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 2878,
},
time: 1714709244615.406,
},
event42: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1504,
},
time: 1715372672224.4255,
},
event43: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 320,
},
time: 1710331215554.826,
},
event44: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1906,
},
time: 1710184345462.6362,
},
event45: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1246,
},
time: 1725198486655.9883,
},
event46: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 1476,
},
time: 1706451804586.463,
},
event47: {
entityIds: {
from: "Ace Financial Group",
to: "Felicity Financial Services",
},
data: {
amount: 192,
},
time: 1723811742494.3857,
},
},
eventTypes: {
default: {
lineWidth: 2,
color: "#00a2ed",
},
},
}; <!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>