版本问题v3到v4v5
// 错误提示
"export 'scale' (imported as 'd3') was not found in 'd3'
https://github.com/d3/d3/blob/master/CHANGES.md#scales-d3-scale
scale 映射
const x = d3.scaleLinear()
.domain([10, 130])
.range([0, 960]);
line path
svg.selectAll("path")
.data(data)
.enter()
.append("path") // <-E
.attr('stroke', 'red')
.attr("fill", "none")
.attr("d", d=>line(d)); // <-F
网友评论