When creating a cardinal curve in d3 v3, I would use tension(.0)
to create a certain curve. However, in d3 v4, the tension seems to have been changed. To get the same curve, I need to use tension(-1.3)
. This shouldn't even work, since the tension should be between 0 and 1.
Fiddle for the v3: https://jsfiddle.net/diogoscf/5st4wk7c/
Fiddle for the v4 that should work but doesn't: https://jsfiddle.net/diogoscf/3xma5wxu/
Fiddle for the v4 that shouldn't work but does: https://jsfiddle.net/diogoscf/3xma5wxu/2/
Is this a bug in d3 v4? I don't want to exploit bugs since they could get patched and break my code, but this is the only way it seems to work. If there's another way, please inform.
I don't think it's a bug since catmullRom
with alpha 0 yield the same result as it should, curveNatural
gives the closest result to what you are expecting, using negative tension values is a bad idea, it shouldn't even draw the line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With