chart = {
const svg = d3.create('svg')
.attr('width', width )
.attr('height', height)
svg.append('g')
.attr('class', 'x-axis')
.attr('transform', `translate(0,${ height- margin.bottom})`)
.call( xAxis )
svg.append('g')
.attr('class', 'y-axis')
.attr('transform', `translate(${ margin.left },0)`)
.call( yAxis )
svg.append('g')
.attr('class', 'bars')
.selectAll('rect')
.data(genes)
.join('rect')
.attr('class', 'bar')
.attr('x', d => x(d.year))
.attr('y', d => y(d.end))
.attr('width', function(d,i) {return x.bandwidth()})
.attr('height',d => y(d.start) - y(d.end))
.style("fill", function(d) { return color(d.name); })
.on("click", function(d) {
var gene_index = categories_shift.indexOf(d.name);
moveStuff(gene_index);
})
.on('mouseover', tip.show)
.on('mouseout', tip.hide);
var valueline = d3.line()
.x(function(d) { return x(d.sample); })
.y(function(d) { return y(d.total); });
svg.append("path")
.attr("class", "line")
.attr("d", valueline(data));
return svg.node();
}