Expose d3.svg.area().interpolate() as public member in stackedArea and

stackedAreaChart. The default value for interpolate is "linear" as it's
the default in d3.
This commit is contained in:
dragansah 2012-09-08 17:26:36 +02:00
parent 6948a309ef
commit 73d5df06e6
2 changed files with 11 additions and 2 deletions

View File

@ -15,6 +15,7 @@ nv.models.stackedArea = function() {
, style = 'stack'
, offset = 'zero'
, order = 'default'
, interpolate = 'linear' // controls the line interpolation
, clipEdge = false // if true, masks lines within x and y scale
, x //can be accessed via chart.xScale()
, y //can be accessed via chart.yScale()
@ -137,7 +138,8 @@ nv.models.stackedArea = function() {
var area = d3.svg.area()
.x(function(d,i) { return x(getX(d,i)) })
.y0(function(d) { return y(d.display.y0) })
.y1(function(d) { return y(d.display.y + d.display.y0) });
.y1(function(d) { return y(d.display.y + d.display.y0) })
.interpolate(interpolate);
var zeroArea = d3.svg.area()
.x(function(d,i) { return x(getX(d,i)) })
@ -317,6 +319,13 @@ nv.models.stackedArea = function() {
return chart;
};
chart.interpolate = function(_) {
if (!arguments.length) return interpolate;
interpolate = _;
return interpolate;
};
//============================================================

View File

@ -312,7 +312,7 @@ nv.models.stackedAreaChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize');
d3.rebind(chart, stacked, 'x', 'y', 'size', 'xScale', 'yScale', 'xDomain', 'yDomain', 'sizeDomain', 'interactive', 'offset', 'order', 'style', 'clipEdge', 'forceX', 'forceY', 'forceSize', 'interpolate');
chart.margin = function(_) {
if (!arguments.length) return margin;