chart = {
const svg = d3.select(DOM.svg(width, height))
.style("-webkit-tap-highlight-color", "transparent")
.style('overflow-x', 'scroll');
svg.append("g")
.attr("fill", "steelblue")
.selectAll("rect")
.data(captions)
.join("rect")
.attr("x", d => xts(d.timeStop))
.attr("y", 200)
.attr("height", d =>y(0) - y(d.laugh))
.attr("width", 1)
.on("mouseover",function(){
d3.select(this)
.attr("opacity", "0");
})
.on("mouseout",function(){
d3.select(this)
.attr("opacity", "1")
});
svg.append("g")
.selectAll('links')
.data(topics)
.enter()
.append('path')
.attr('d', function (d) {
var start = xtopics(d.timeStart)
var end = ytopics(d.topicEnd)
return ['M', start, height-101,
'A',
(start - end)/2, ',',
(start - end)/2, 0, 0, ',',
start < end ? 1 : 0, end, ',', height-101]
.join(' ');
})
.style("fill", "none")
.attr("stroke", "grey")
svg.append("line")
.attr("x1", 1)
.attr("y1", 290)
.attr("x2", width)
.attr("y2", 290)
.attr("stroke-width", 10)
.attr("stroke", "#DDE8F1");
svg.append("g")
.attr("fill", "black")
.attr("text-anchor", "end")
.style("font", "12px sans-serif")
.selectAll("text")
.data(captions)
.join("text")
.attr("x", d => xts(d.timeStart))
.attr("y", 290)
.attr("dy", "0.35em")
.text(d => d.start)
.attr("opacity", "0")
.on("mouseover",function(){
d3.select(this)
.attr("opacity", "1")
})
.on("mouseout",function(){
d3.select(this)
.attr("opacity", "0")
});
return svg.node();
}