multilinechart2 = {
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.style('border', '1px dotted #999');
let legend = svg.selectAll(".legend")
.data(dataGroup2)
.enter();
legend
.append('text')
.text(d => d[0])
.attr('x', legendOrigin[0] + labelHeight * 1.2)
.attr('y', (d,i) => legendOrigin[1] + labelHeight * i * 1.2 )
.style('font-family', 'sans-serif')
.style('font-size', `${labelHeight-1}px`);
legend
.append('rect')
.attr('x', legendOrigin[0])
.attr('y', (d,i) => legendOrigin[1] + labelHeight * 1.2 * i - 7)
.attr('width', labelHeight)
.attr('height', labelHeight/2)
.attr('fill', d => colorScale2(d[0]))
.attr('stroke', 'none')
.style('stroke-width', '1.5px');
svg.append("g")
.call(xmultiAxis2);
svg.append("g")
.call(ymultiAxis2);
svg.selectAll('.line')
.data(dataGroup2)
.join('path')
.attr("class", "line")
.attr("d", d => lineMultiValues2(d[1]))
.attr("stroke", d => colorScale2(d))
.style("fill", "none")
.style("stroke-width", 3);
return svg.node();
}