Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defined to stacked area chart #1288

Merged
merged 1 commit into from
Oct 10, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/models/stackedArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ nv.models.stackedArea = function() {
, container = null
, getX = function(d) { return d.x } // accessor to get the x value from a data point
, getY = function(d) { return d.y } // accessor to get the y value from a data point
, defined = function(d,i) { return !isNaN(getY(d,i)) && getY(d,i) !== null } // allows a line to be not continuous when it is not defined
, style = 'stack'
, offset = 'zero'
, order = 'default'
Expand Down Expand Up @@ -134,6 +135,7 @@ nv.models.stackedArea = function() {
g.attr('clip-path', clipEdge ? 'url(#nv-edge-clip-' + id + ')' : '');

var area = d3.svg.area()
.defined(defined)
.x(function(d,i) { return x(getX(d,i)) })
.y0(function(d) {
return y(d.display.y0)
Expand All @@ -144,6 +146,7 @@ nv.models.stackedArea = function() {
.interpolate(interpolate);

var zeroArea = d3.svg.area()
.defined(defined)
.x(function(d,i) { return x(getX(d,i)) })
.y0(function(d) { return y(d.display.y0) })
.y1(function(d) { return y(d.display.y0) });
Expand Down Expand Up @@ -269,6 +272,7 @@ nv.models.stackedArea = function() {
// simple options, just get/set the necessary values
width: {get: function(){return width;}, set: function(_){width=_;}},
height: {get: function(){return height;}, set: function(_){height=_;}},
defined: {get: function(){return defined;}, set: function(_){defined=_;}},
clipEdge: {get: function(){return clipEdge;}, set: function(_){clipEdge=_;}},
offset: {get: function(){return offset;}, set: function(_){offset=_;}},
order: {get: function(){return order;}, set: function(_){order=_;}},
Expand Down