<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="">
</head>
<body>
<svg width="600" height="500"></svg>
<script src="../d3.js"></script>
<script>
var lines = [[80,80],[200,100],[200,200],[100,200]];
var linePath = d3.line()
.x(function (value) {
return value[0]*2
})
.y(function (value) {
return value[1]*2
});
//下面这些生成不同的线
// console.log(linePath.curve(d3.curveBasis))
// console.log(linePath.curve(d3.curveLinear))
// console.log(linePath.curve(d3.curveStep))
// console.log(linePath.curve(d3.curveLinearClosed))
// console.log(linePath.curve(d3.curveBundle))
// console.log(linePath.curve(d3.curveCardinal))
// console.log(linePath.curve(d3.curveMonotoneX))
// console.log(linePath.curve(d3.curveMonotoneY))
//选择数据
// linePath.defined(function (value) {
// return value[0]>90;
// });
var svg = d3.select('svg');
svg.append('path')
.attr('d',linePath(lines))
.attr('stroke','#000')
.attr('stroke-width',1)
.attr('fill','none')
</script>
</body>
</html>