I was using the following code:
var c = d3.line()
.interpolate("monotone")
.x(function(d) { return x(d.date); })
.y(function(d) { return y(d.close); });
And now that I am updating all my visual studies to D3 version 4 I can't work out how to upgrade the above interpolation.
I want to smooth the line.
This is the code using D3 version 4.x:
var c = d3.line()
.curve(d3.curveMonotoneX)
.x(function(d) { return x(d.date); })
.y(function(d) { return y(d.close); });
You can also use d3.curveMonotoneY
, depending on the axis you want to preserve the monotonicity.
Here is the API.
Link to changes v3 to v4.
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