chart = {
const height = 100;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, 600, height])
.attr("height", 200);
const g = svg.append('g');
const yScale = (x) => (height - x);
sortedTimelines.forEach((timeline, timelineIndex)=> {
for (let t = timeline.start; t <= timeline.end; t++) {
const t0 = t;
const t1 = t+1;
const height0 = heightAtTime(timelineIndex, t0);
const height1 = heightAtTime(timelineIndex, t1);
const y0 = yAtTime(timelineIndex, t0);
const y1 = yAtTime(timelineIndex, t1);
const x0 = DT_WIDTH*t0;
const x1 = DT_WIDTH*t1;
const d = `M ${x0} ${yScale(y0)} L ${x0} ${yScale(y0+height0)} L ${x1} ${yScale(y1+height1)} L ${x1} ${yScale(y1)} z`;
g.append('path')
.attr("d", d)
.attr('fill', d3.interpolateCool(timelineIndex/(sortedTimelines.length-1)));
}
});
return svg.node();
}