D3 2.10 allows you to implement custom interpolators for d3.svg.line and d3.svg.area. This contrived example shows how to draw arcs between data points using SVG’s elliptical arc path segments.
var line = d3.svg.line()
.interpolate(function(points) { return points.join("A 1,1 0 0 1 "); })
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });
Hello Mike,
function(points) { return points.join("L")} seems to work for interpolation but when i pass "monotone" or "basis" in the argument, it is not rendering the interpolation, what do you think might be the reason, can you please let me know whats the custo interpolation function for "monotone":
//works
var area = d3.svg.area()
.x(function(d) {
...
})
.y0(height)
.y1(function(d, i) {
...
})
.interpolate(function(points) { return points.join("L")});
//works
var area = d3.svg.area()
.x(function(d) {
...
})
.y0(height)
.y1(function(d, i) {
...
});
//doesnt apple the interpolation
var area = d3.svg.area()
.x(function(d) {
...
})
.y0(height)
.y1(function(d, i) {
...
})
.interpolate("monotone");