In the documentation for d3.js I cannot find a straightforward way to draw a simple line segment between two points. The only way I can find there to do this is on
Simplest is:
d3.select('svg')
.append('path')
.attr({
d: "M0,0L200,200"
stroke: '#000'
});
This is not too bad:
var simpleLine = d3.svg.line()
d3.select('svg')
.append('path')
.attr({
d: simpleLine([[0,0],[200,200]]),
stroke: '#000'
});
Still....
Dunno if this is simpler, but it's maybe more direct:
d3.select('svg')
.append('line')
.attr({
x1: 0,
y1: 0,
x2: 200,
y2: 200,
stroke: '#000'
})
(All three examples draw a line from 0,0 to 200,200)