]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Span gaps option should be specified at the chart level 2811/head
authorEvert Timberg <evert.timberg+github@gmail.com>
Mon, 20 Jun 2016 18:42:09 +0000 (14:42 -0400)
committerEvert Timberg <evert.timberg+github@gmail.com>
Mon, 20 Jun 2016 18:42:09 +0000 (14:42 -0400)
docs/03-Line-Chart.md
src/controllers/controller.line.js

index adf1e33ae464cf5b17b71a9a7afeca622cd36631..d4b6ea902ceb4f750b084ccd8ab2845e3db1b0cf 100644 (file)
@@ -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.
 
index a0138eed2c52fc656c9fe3a2b2a142afe6354edc..0cd16f0784a2aad74a07e97bae1d3b8ff6597026 100644 (file)
@@ -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),