chart = {
const svg= d3.create('svg')
.attr('viewBox',[0,0,width,height]);
svg.append('g')
.call(xAxis);
svg.append('g')
.call(yAxis);
svg.append('path')
.datum(data)
.attr('fill','none')
.attr('stroke', color)
.attr('stroke-width','1')
.attr("opacity", "0.5")
.attr('stroke-linejoin','round')
.attr('stroke-linecap','round')
.attr('d',line);
svg.append("path")
.data([data])
.attr("class", "area")
.attr("d", area)
.attr("fill", color)
.attr("opacity", "0.2");
svg.selectAll("dot")
.data(data)
.enter().append("circle")
.attr("class", "dot")
.attr("r", function(d) { return r(d.close)} )
.attr("cx", function(d) { return x(d.date) })
.attr("cy", function(d) { return y(d.close) })
.attr("opacity", "0.7")
.attr("fill", color);
return svg.node();
}