Demonstration of some odd behaviour of d3-shape's linkTo
and arc
.
The diagrams are generated from the same set of coordinates run through a function that generates variations on paths; for any line from (x0,y0)
to (x1,y1)
, the options are:
curved
: uses one of d3's link
functions, linkHorizontal
, linkVertical
or linkRadial
;direct
: straight line;l_shape
and l_shape_alt
: an L-shaped line, or an arc and straight line if using radial coordinates;dogleg
and dogleg_alt
: a dogleg, or in radial charts, arc-straight line-arc or straight line-arc-straight line.The diagrams demonstrate the odd behaviour of the linkTo
and arc
commands when used in sequence. The uncorrected
radial charts demonstrate the default behaviour, and the corrected
charts have -0.5 Pi radians applied to the angles, i.e. for a line from a
to b
:
context.arc(0, 0, b.y, a.x, b.x);
context.arc(0, 0, b.y, a.x - Math.PI*0.5, b.x - Math.PI*0.5);
https://d3js.org/d3.v5.min.js