chart2 = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append('text', 'label');
svg.append("text")
.attr("x", width / 2)
.attr("y", height)
.text("Date")
.style("font-size", "20px")
svg.append("text")
.attr("transform", "translate(10, 300) rotate(-90)")
.text("Temperature")
.style("font-size", "20px")
svg
.selectAll('.rect')
.data(data_array)
.join(enter => enter.append("rect"))
.attr("x", d => x_scale(d.x))
.attr("y", d => y_scale(d.y))
.attr('width', 5)
.attr("height", d => y_scale(0) - y_scale(d.y))
.attr('fill', d => d.color)
.attr('opacity', 0.3)
return svg.node();
}