From db8ed6a6c0caae3f229aa71724305aba6fc7349e Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Mon, 20 Jun 2016 14:42:09 -0400 Subject: [PATCH] Span gaps option should be specified at the chart level --- docs/03-Line-Chart.md | 1 + src/controllers/controller.line.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/03-Line-Chart.md b/docs/03-Line-Chart.md index adf1e33ae..d4b6ea902 100644 --- a/docs/03-Line-Chart.md +++ b/docs/03-Line-Chart.md @@ -144,6 +144,7 @@ These are the customisation options specific to Line charts. These options are m Name | Type | Default | Description --- | --- | --- | --- showLines | Boolean | true | If false, the lines between points are not drawn +spanGaps | Boolean | false | If true, NaN data does not break the line You can override these for your `Chart` instance by passing a member `options` into the `Line` method. diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index a0138eed2..0cd16f078 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -6,6 +6,7 @@ module.exports = function(Chart) { Chart.defaults.line = { showLines: true, + spanGaps: false, hover: { mode: "label" @@ -78,7 +79,7 @@ module.exports = function(Chart) { // The default behavior of lines is to break at null values, according // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158 // This option gives linse the ability to span gaps - spanGaps: dataset.spanGaps ? dataset.spanGaps : false, + spanGaps: dataset.spanGaps ? dataset.spanGaps : options.spanGaps, tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.lineTension, lineElementOptions.tension), backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth),