]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Support spanGaps in radar charts (#6289)
authorAkihiko Kusanagi <nagi@nagi-p.com>
Wed, 19 Jun 2019 11:12:53 +0000 (19:12 +0800)
committerEvert Timberg <evert.timberg@gmail.com>
Wed, 19 Jun 2019 11:12:53 +0000 (07:12 -0400)
* Support spanGaps in radar charts

* Minor fixes based on feedback

29 files changed:
docs/charts/radar.md
src/controllers/controller.radar.js
src/elements/element.line.js
src/plugins/plugin.filler.js
test/fixtures/plugin.filler/fill-radar-boundary-end-circular.json
test/fixtures/plugin.filler/fill-radar-boundary-end-circular.png
test/fixtures/plugin.filler/fill-radar-boundary-end-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-end-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-end.json
test/fixtures/plugin.filler/fill-radar-boundary-end.png
test/fixtures/plugin.filler/fill-radar-boundary-origin-circular.json
test/fixtures/plugin.filler/fill-radar-boundary-origin-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-origin-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.json
test/fixtures/plugin.filler/fill-radar-boundary-origin.json
test/fixtures/plugin.filler/fill-radar-boundary-origin.png
test/fixtures/plugin.filler/fill-radar-boundary-start-circular.json
test/fixtures/plugin.filler/fill-radar-boundary-start-circular.png
test/fixtures/plugin.filler/fill-radar-boundary-start-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-start-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-boundary-start.json
test/fixtures/plugin.filler/fill-radar-boundary-start.png
test/fixtures/plugin.filler/fill-radar-dataset-border.json
test/fixtures/plugin.filler/fill-radar-dataset-span.json [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-dataset-span.png [new file with mode: 0644]
test/fixtures/plugin.filler/fill-radar-dataset-spline.json
test/fixtures/plugin.filler/fill-radar-dataset.json

index c9c6b11eaeb69339720649ef0e601770279d1bb0..90e05a55e83817de14f5aec63a2bbe0adb18298f 100644 (file)
@@ -87,6 +87,7 @@ The radar chart allows a number of properties to be specified for each dataset.
 | [`pointRadius`](#point-styling) | `number` | Yes | Yes | `3`
 | [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0`
 | [`pointStyle`](#point-styling) | <code>string&#124;Image</code> | Yes | Yes | `'circle'`
+| [`spanGaps`](#line-styling) | `boolean` | - | - | `undefined`
 
 ### General
 
@@ -125,8 +126,9 @@ The style of the line can be controlled with the following properties:
 | `borderWidth` | The line width (in pixels).
 | `fill` | How to fill the area under the line. See [area charts](area.md).
 | `lineTension` | Bezier curve tension of the line. Set to 0 to draw straightlines.
+| `spanGaps` | If true, lines will be drawn between points with no or null data. If false, points with `NaN` data will create a break in the line.
 
-All these values, if `undefined`, fallback to the associated [`elements.line.*`](../configuration/elements.md#line-configuration) options.
+If the value is `undefined`, `spanGaps` fallback to the associated [chart configuration options](#configuration-options). The rest of the values fallback to the associated [`elements.line.*`](../configuration/elements.md#line-configuration) options.
 
 ### Interactions
 
index c789250ef128a8047461bce50b217b77bd22b9a6..57fd8267bd9d349bdf899cdd188aa656c22aeaed 100644 (file)
@@ -143,9 +143,12 @@ module.exports = DatasetController.extend({
         */
        _resolveDatasetElementOptions: function() {
                var me = this;
+               var config = me._config;
+               var options = me.chart.options;
                var values = DatasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);
 
-               values.tension = valueOrDefault(me._config.lineTension, me.chart.options.elements.line.tension);
+               values.spanGaps = valueOrDefault(config.spanGaps, options.spanGaps);
+               values.tension = valueOrDefault(config.lineTension, options.elements.line.tension);
 
                return values;
        },
@@ -157,6 +160,13 @@ module.exports = DatasetController.extend({
                var points = meta.data || [];
                var i, ilen, model, controlPoints;
 
+               // Only consider points that are drawn in case the spanGaps option is used
+               if (meta.dataset._model.spanGaps) {
+                       points = points.filter(function(pt) {
+                               return !pt._model.skip;
+                       });
+               }
+
                function capControlPoint(pt, min, max) {
                        return Math.max(Math.min(pt, max), min);
                }
index b0e799d27709609170b7cd7641847b63b46f4b37..5fa728bfe2cfcaa01553394f2a2361577005f0cd 100644 (file)
@@ -38,17 +38,16 @@ module.exports = Element.extend({
                var globalOptionLineElements = globalDefaults.elements.line;
                var lastDrawnIndex = -1;
                var closePath = me._loop;
-               var index, current, previous, currentVM;
+               var index, previous, currentVM;
 
                if (me._loop && points.length) {
-                       if (!spanGaps) {
-                               for (index = points.length - 1; index >= 0; --index) {
-                                       // If the line has an open path, shift the point array
-                                       if (points[index]._view.skip) {
-                                               points = points.slice(index).concat(points.slice(0, index));
-                                               closePath = false;
-                                               break;
-                                       }
+                       for (index = 0; index < points.length; ++index) {
+                               previous = helpers.previousItem(points, index);
+                               // If the line has an open path, shift the point array
+                               if (!points[index]._view.skip && previous._view.skip) {
+                                       points = points.slice(index).concat(points.slice(0, index));
+                                       closePath = spanGaps;
+                                       break;
                                }
                        }
                        // If the line has a close path, add the first point again
@@ -77,9 +76,8 @@ module.exports = Element.extend({
                lastDrawnIndex = -1;
 
                for (index = 0; index < points.length; ++index) {
-                       current = points[index];
                        previous = helpers.previousItem(points, index);
-                       currentVM = current._view;
+                       currentVM = points[index]._view;
 
                        // First point moves to it's starting position no matter what
                        if (index === 0) {
@@ -96,7 +94,7 @@ module.exports = Element.extend({
                                                ctx.moveTo(currentVM.x, currentVM.y);
                                        } else {
                                                // Line to next point
-                                               helpers.canvas.lineTo(ctx, previous._view, current._view);
+                                               helpers.canvas.lineTo(ctx, previous._view, currentVM);
                                        }
                                        lastDrawnIndex = index;
                                }
index 3388bb821d25ac03716c93addbe6dfa47f4c1e84..8acbc40742ca15d064107add213aa2d4de473fc2 100644 (file)
@@ -271,17 +271,22 @@ function doFill(ctx, points, mapper, view, color, loop) {
        var curve1 = [];
        var len0 = 0;
        var len1 = 0;
-       var i, ilen, index, p0, p1, d0, d1;
+       var i, ilen, index, p0, p1, d0, d1, loopOffset;
 
        ctx.beginPath();
 
-       for (i = 0, ilen = (count + !!loop); i < ilen; ++i) {
+       for (i = 0, ilen = count; i < ilen; ++i) {
                index = i % count;
                p0 = points[index]._view;
                p1 = mapper(p0, index, view);
                d0 = isDrawable(p0);
                d1 = isDrawable(p1);
 
+               if (loop && loopOffset === undefined && d0) {
+                       loopOffset = i + 1;
+                       ilen = count + loopOffset;
+               }
+
                if (d0 && d1) {
                        len0 = curve0.push(p0);
                        len1 = curve1.push(p1);
index e6c982f3bb5f28c9a86de41842531f52e36b8209..4a8553bc26ee3643d9df94aa7accce333cc38cc3 100644 (file)
@@ -5,20 +5,21 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, null, 3, 2.5, null, -2, 1.5, 3]
+                "data": [5.5, 2, null, 4, 5, null, null, 2, 1]
             }, {
                 "backgroundColor": "rgba(192, 0, 0, 0.25)",
-                "data": [3.5, 2, 1, 2.5, -2, 3, -1, null, null]
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
             }, {
-                "backgroundColor": "rgba(128, 0, 128, 0.25)",
-                "data": [5, 6, 5, -2, -4, -3, 4, 2, 4.5]
+                "backgroundColor": "rgba(0, 0, 192, 0.25)",
+                "data": [8, 7, 6.5, -6, -4, -6, 4, 5, 8]
             }]
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index 1dff6bf84d088937f1b646044d93278b0ff89015..1cca06775cb01f3d132325aac7424f9a4695f7c6 100644 (file)
Binary files a/test/fixtures/plugin.filler/fill-radar-boundary-end-circular.png and b/test/fixtures/plugin.filler/fill-radar-boundary-end-circular.png differ
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-end-span.json b/test/fixtures/plugin.filler/fill-radar-boundary-end-span.json
new file mode 100644 (file)
index 0000000..29b444a
--- /dev/null
@@ -0,0 +1,45 @@
+{
+    "config": {
+        "type": "radar",
+        "data": {
+            "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
+            "datasets": [{
+                "backgroundColor": "rgba(0, 0, 192, 0.25)",
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
+            }, {
+                "backgroundColor": "rgba(0, 192, 0, 0.25)",
+                "data": [5.5, 2, null, 4, 5, null, null, 2, 1]
+            }, {
+                "backgroundColor": "rgba(192, 0, 0, 0.25)",
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
+            }, {
+                "backgroundColor": "rgba(0, 0, 192, 0.25)",
+                "data": [8, 7, 6.5, -6, -4, -6, 4, 5, 8]
+            }]
+        },
+        "options": {
+            "responsive": false,
+            "spanGaps": true,
+            "legend": false,
+            "title": false,
+            "scale": {
+                "display": false
+            },
+            "elements": {
+                "point": {
+                    "radius": 0
+                },
+                "line": {
+                    "borderColor": "transparent",
+                    "fill": "end"
+                }
+            }
+        }
+    },
+    "options": {
+        "canvas": {
+            "height": 256,
+            "width": 256
+        }
+    }
+}
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-end-span.png b/test/fixtures/plugin.filler/fill-radar-boundary-end-span.png
new file mode 100644 (file)
index 0000000..caa742b
Binary files /dev/null and b/test/fixtures/plugin.filler/fill-radar-boundary-end-span.png differ
index 2018e4822f097357727a1715a49c12ac3d332e39..f725625966a38783d2d7e1b480b03cec178c26c8 100644 (file)
@@ -5,20 +5,21 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, null, 3, 2.5, null, -2, 1.5, 3]
+                "data": [5.5, 2, null, 4, 5, null, null, 2, 1]
             }, {
                 "backgroundColor": "rgba(192, 0, 0, 0.25)",
-                "data": [3.5, 2, 1, 2.5, -2, 3, -1, null, null]
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
             }, {
-                "backgroundColor": "rgba(128, 0, 128, 0.25)",
-                "data": [5, 6, 5, -2, -4, -3, 4, 2, 4.5]
+                "backgroundColor": "rgba(0, 0, 192, 0.25)",
+                "data": [8, 7, 6.5, -6, -4, -6, 4, 5, 8]
             }]
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index c17f9367d249db1b2b5f1471272e00fb088c75ae..c7c7173e11f7fd58074f50fba3f45335b8c655fb 100644 (file)
Binary files a/test/fixtures/plugin.filler/fill-radar-boundary-end.png and b/test/fixtures/plugin.filler/fill-radar-boundary-end.png differ
index af50665f5de49d58a4d8e836a710b75adc16c36b..5e2e0878935d7f30cfa9343e0587f975454790b8 100644 (file)
@@ -19,6 +19,7 @@
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin-span.json b/test/fixtures/plugin.filler/fill-radar-boundary-origin-span.json
new file mode 100644 (file)
index 0000000..7b72cf4
--- /dev/null
@@ -0,0 +1,45 @@
+{
+    "config": {
+        "type": "radar",
+        "data": {
+            "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
+            "datasets": [{
+                "backgroundColor": "rgba(0, 0, 192, 0.25)",
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
+            }, {
+                "backgroundColor": "rgba(0, 192, 0, 0.25)",
+                "data": [6, 2, null, 4, 5, null, null, 2, 1]
+            }, {
+                "backgroundColor": "rgba(192, 0, 0, 0.25)",
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
+            }, {
+                "backgroundColor": "rgba(0, 64, 192, 0.25)",
+                "data": [8, 7, 6, -6, -4, -6, 4, 5, 8]
+            }]
+        },
+        "options": {
+            "responsive": false,
+            "spanGaps": true,
+            "legend": false,
+            "title": false,
+            "scale": {
+                "display": false
+            },
+            "elements": {
+                "point": {
+                    "radius": 0
+                },
+                "line": {
+                    "borderColor": "transparent",
+                    "fill": "origin"
+                }
+            }
+        }
+    },
+    "options": {
+        "canvas": {
+            "height": 256,
+            "width": 256
+        }
+    }
+}
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin-span.png b/test/fixtures/plugin.filler/fill-radar-boundary-origin-span.png
new file mode 100644 (file)
index 0000000..7f043db
Binary files /dev/null and b/test/fixtures/plugin.filler/fill-radar-boundary-origin-span.png differ
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.json b/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.json
new file mode 100644 (file)
index 0000000..6e99d20
--- /dev/null
@@ -0,0 +1,46 @@
+{
+    "config": {
+        "type": "radar",
+        "data": {
+            "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
+            "datasets": [{
+                "backgroundColor": "rgba(0, 0, 192, 0.25)",
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
+            }, {
+                "backgroundColor": "rgba(0, 192, 0, 0.25)",
+                "data": [4, 2, null, 3, 2.5, null, -2, 1.5, 3]
+            }, {
+                "backgroundColor": "rgba(192, 0, 0, 0.25)",
+                "data": [3.5, 2, 1, 2.5, -2, 3, -1, null, null]
+            }, {
+                "backgroundColor": "rgba(128, 0, 128, 0.25)",
+                "data": [5, 6, 5, -2, -4, -3, 4, 2, 4.5]
+            }]
+        },
+        "options": {
+            "responsive": false,
+            "spanGaps": true,
+            "legend": false,
+            "title": false,
+            "scale": {
+                "display": false
+            },
+            "elements": {
+                "point": {
+                    "radius": 0
+                },
+                "line": {
+                    "borderColor": "transparent",
+                    "tension": 0.5,
+                    "fill": "origin"
+                }
+            }
+        }
+    },
+    "options": {
+        "canvas": {
+            "height": 256,
+            "width": 256
+        }
+    }
+}
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.png b/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.png
new file mode 100644 (file)
index 0000000..b9b4dde
Binary files /dev/null and b/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline-span.png differ
index e5c4b2f800927f793a48a177e16def1a2659a727..caf1a4e6a05f087f8ec62c2720108d4ed28b7f2b 100644 (file)
@@ -19,6 +19,7 @@
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index 0cc32b4a93aaaf6d6bcfa37f396b00c51e98c624..e4f52186eab52213104d72f00089f66e7c80c08d 100644 (file)
@@ -5,20 +5,21 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, null, 3, 2.5, null, -2, 1.5, 3]
+                "data": [6, 2, null, 4, 5, null, null, 2, 1]
             }, {
                 "backgroundColor": "rgba(192, 0, 0, 0.25)",
-                "data": [3.5, 2, 1, 2.5, -2, 3, -1, null, null]
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
             }, {
-                "backgroundColor": "rgba(128, 0, 128, 0.25)",
-                "data": [5, 6, 5, -2, -4, -3, 4, 2, 4.5]
+                "backgroundColor": "rgba(0, 64, 192, 0.25)",
+                "data": [8, 7, 6, -6, -4, -6, 4, 5, 8]
             }]
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index af1725f910c0856935cbce26f0f1b3dc89d0c622..2194bc4ae9848fcbd19af45cd245b15b68dc5dd7 100644 (file)
Binary files a/test/fixtures/plugin.filler/fill-radar-boundary-origin.png and b/test/fixtures/plugin.filler/fill-radar-boundary-origin.png differ
index aec9f5112287e8636a1fd6183040ff090634d79a..bbd7c74283ce5269d9253d23a63091150cc33f3a 100644 (file)
@@ -4,21 +4,22 @@
         "data": {
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
-                "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
             }, {
-                "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, null, 3, 2.5, null, -2, 1.5, 3]
+                "backgroundColor": "rgba(0, 255, 0, 0.25)",
+                "data": [6, 2, null, 4, 5, null, null, 2, 1]
             }, {
-                "backgroundColor": "rgba(192, 0, 0, 0.25)",
-                "data": [3.5, 2, 1, 2.5, -2, 3, -1, null, null]
+                "backgroundColor": "rgba(255, 0, 0, 0.25)",
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
             }, {
-                "backgroundColor": "rgba(128, 0, 128, 0.25)",
-                "data": [5, 6, 5, -2, -4, -3, 4, 2, 4.5]
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [8, 7, 6, -6, -4, -6, 4, 5, 8]
             }]
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index 8be3f232cc2261dee324163fcf906f9cc6d1b5d9..b0f8f8f0a960f0cc04e0a8d3db6487dce5494039 100644 (file)
Binary files a/test/fixtures/plugin.filler/fill-radar-boundary-start-circular.png and b/test/fixtures/plugin.filler/fill-radar-boundary-start-circular.png differ
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-start-span.json b/test/fixtures/plugin.filler/fill-radar-boundary-start-span.json
new file mode 100644 (file)
index 0000000..2f59ccf
--- /dev/null
@@ -0,0 +1,45 @@
+{
+    "config": {
+        "type": "radar",
+        "data": {
+            "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
+            "datasets": [{
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
+            }, {
+                "backgroundColor": "rgba(0, 255, 0, 0.25)",
+                "data": [6, 2, null, 4, 5, null, null, 2, 1]
+            }, {
+                "backgroundColor": "rgba(255, 0, 0, 0.25)",
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
+            }, {
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [8, 7, 6, -6, -4, -6, 4, 5, 8]
+            }]
+        },
+        "options": {
+            "responsive": false,
+            "spanGaps": true,
+            "legend": false,
+            "title": false,
+            "scale": {
+                "display": false
+            },
+            "elements": {
+                "point": {
+                    "radius": 0
+                },
+                "line": {
+                    "borderColor": "transparent",
+                    "fill": "start"
+                }
+            }
+        }
+    },
+    "options": {
+        "canvas": {
+            "height": 256,
+            "width": 256
+        }
+    }
+}
diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-start-span.png b/test/fixtures/plugin.filler/fill-radar-boundary-start-span.png
new file mode 100644 (file)
index 0000000..d97e691
Binary files /dev/null and b/test/fixtures/plugin.filler/fill-radar-boundary-start-span.png differ
index fcd44ad853a5c004fc42e7cd2460c16a9f171316..4171ffe4288991552be9c05401dd1d381007de1c 100644 (file)
@@ -4,21 +4,22 @@
         "data": {
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
-                "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [null, null, 2, 3, 4, -4, -2, 1, 0]
             }, {
-                "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, null, 3, 2.5, null, -2, 1.5, 3]
+                "backgroundColor": "rgba(0, 255, 0, 0.25)",
+                "data": [6, 2, null, 4, 5, null, null, 2, 1]
             }, {
-                "backgroundColor": "rgba(192, 0, 0, 0.25)",
-                "data": [3.5, 2, 1, 2.5, -2, 3, -1, null, null]
+                "backgroundColor": "rgba(255, 0, 0, 0.25)",
+                "data": [7, 3, 4, 5, 6, 1, 4, null, null]
             }, {
-                "backgroundColor": "rgba(128, 0, 128, 0.25)",
-                "data": [5, 6, 5, -2, -4, -3, 4, 2, 4.5]
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [8, 7, 6, -6, -4, -6, 4, 5, 8]
             }]
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index 82b1f60478d1e0f83d5900986b43d400d906a1d9..749913145a1b1f0d000073c9423fd1571d2eea15 100644 (file)
Binary files a/test/fixtures/plugin.filler/fill-radar-boundary-start.png and b/test/fixtures/plugin.filler/fill-radar-boundary-start.png differ
index a7f5fb658a7ccf4b567287559f39fd822406714d..6881fbb6fd284dfe45b5271ac825bca005f1a1b6 100644 (file)
@@ -27,7 +27,8 @@
         },
         "options": {
             "responsive": false,
-           "legend": false,
+            "spanGaps": false,
+            "legend": false,
             "title": false,
             "scale": {
                 "display": false
diff --git a/test/fixtures/plugin.filler/fill-radar-dataset-span.json b/test/fixtures/plugin.filler/fill-radar-dataset-span.json
new file mode 100644 (file)
index 0000000..537adae
--- /dev/null
@@ -0,0 +1,53 @@
+{
+    "config": {
+        "type": "radar",
+        "data": {
+            "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
+            "datasets": [{
+                "backgroundColor": "rgba(255, 0, 0, 0.25)",
+                "data": [null, null, 0, -1, 0, 1, 0, -1, 0],
+                "fill": 1
+            }, {
+                "backgroundColor": "rgba(0, 255, 0, 0.25)",
+                "data": [1, 0, null, 1, 0, null, -1, 0, 1],
+                "fill": "+1"
+            }, {
+                "backgroundColor": "rgba(0, 0, 255, 0.25)",
+                "data": [0, 2, 0, -2, 0, 2, 0],
+                "fill": 3
+            }, {
+                "backgroundColor": "rgba(255, 0, 255, 0.25)",
+                "data": [2, 0, -2, 0, 2, 0, -2, 0, 2],
+                "fill": "-2"
+            }, {
+                "backgroundColor": "rgba(255, 255, 0, 0.25)",
+                "data": [3, 1, -1, -3, -1, 1, 3, 1, -1],
+                "fill": "-1"
+            }]
+        },
+        "options": {
+            "responsive": false,
+            "spanGaps": true,
+            "legend": false,
+            "title": false,
+            "scale": {
+                "display": false
+            },
+            "elements": {
+                "point": {
+                    "radius": 0
+                },
+                "line": {
+                    "borderColor": "transparent",
+                    "tension": 0
+                }
+            }
+        }
+    },
+    "options": {
+        "canvas": {
+            "height": 256,
+            "width": 256
+        }
+    }
+}
diff --git a/test/fixtures/plugin.filler/fill-radar-dataset-span.png b/test/fixtures/plugin.filler/fill-radar-dataset-span.png
new file mode 100644 (file)
index 0000000..48e7e89
Binary files /dev/null and b/test/fixtures/plugin.filler/fill-radar-dataset-span.png differ
index ecae77e4b83e7ea1fee4820b9a53c62143d2c4e8..24bd3423cafd2fe595cede299a0cdd5dce7425eb 100644 (file)
@@ -27,6 +27,7 @@
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {
index 69a6df8086801f5965cb7b0b1e6384b1d25abf72..f1d68114e012aa3e584b04a2cbbc369ddd068bff 100644 (file)
@@ -27,6 +27,7 @@
         },
         "options": {
             "responsive": false,
+            "spanGaps": false,
             "legend": false,
             "title": false,
             "scale": {