]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Treat null as NaN in radialLinear scale (#6282)
authorAkihiko Kusanagi <nagi@nagi-p.com>
Tue, 21 May 2019 09:50:38 +0000 (17:50 +0800)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Tue, 21 May 2019 09:50:38 +0000 (11:50 +0200)
22 files changed:
src/scales/scale.radialLinear.js
test/fixtures/controller.radar/backgroundColor/indexable.png
test/fixtures/controller.radar/backgroundColor/scriptable.png
test/fixtures/controller.radar/backgroundColor/value.png
test/fixtures/controller.radar/borderColor/indexable.png
test/fixtures/controller.radar/borderColor/scriptable.png
test/fixtures/controller.radar/borderColor/value.png
test/fixtures/controller.radar/borderWidth/indexable.png
test/fixtures/controller.radar/borderWidth/scriptable.png
test/fixtures/controller.radar/borderWidth/value.png
test/fixtures/controller.radar/pointStyle/indexable.png
test/fixtures/controller.radar/pointStyle/value.png
test/fixtures/plugin.filler/fill-radar-boundary-end-circular.json
test/fixtures/plugin.filler/fill-radar-boundary-end.json
test/fixtures/plugin.filler/fill-radar-boundary-origin-circular.json
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-start-circular.json
test/fixtures/plugin.filler/fill-radar-boundary-start.json
test/fixtures/plugin.filler/fill-radar-dataset-border.json
test/fixtures/plugin.filler/fill-radar-dataset-spline.json
test/fixtures/plugin.filler/fill-radar-dataset.json

index b3922f52245755f23079a66d6260c93ddcb8e2fc..55b23d6d0116398afe9f677855d7255056779ab1 100644 (file)
@@ -412,8 +412,8 @@ module.exports = LinearScaleBase.extend({
        getDistanceFromCenterForValue: function(value) {
                var me = this;
 
-               if (value === null) {
-                       return 0; // null always in center
+               if (helpers.isNullOrUndef(value)) {
+                       return NaN;
                }
 
                // Take into account half font size + the yPadding of the top value
index 6141ca8015bdd04a8aa6e4a8745481323b7bdcf9..4c7bc8f0bd542bb1ac0d5d5554a52a0d834ca5a4 100644 (file)
Binary files a/test/fixtures/controller.radar/backgroundColor/indexable.png and b/test/fixtures/controller.radar/backgroundColor/indexable.png differ
index b1e6d6e5aee23b8b42c90284c4cf8ded91b81706..e82a84f65262bbdc63a89ec34bbdca4731dc11c2 100644 (file)
Binary files a/test/fixtures/controller.radar/backgroundColor/scriptable.png and b/test/fixtures/controller.radar/backgroundColor/scriptable.png differ
index dd7f6de6dc2f5a1b957377b667d9b5ffacc65eb7..da08c0e442c0a1b55702aa02c57346ceaa5b50f3 100644 (file)
Binary files a/test/fixtures/controller.radar/backgroundColor/value.png and b/test/fixtures/controller.radar/backgroundColor/value.png differ
index 00fe42652010d43ca387ff8962a797f33e62a5e5..e4477851c63bcea79205346d4ab5e7c5784d85e2 100644 (file)
Binary files a/test/fixtures/controller.radar/borderColor/indexable.png and b/test/fixtures/controller.radar/borderColor/indexable.png differ
index ea9bb5c303186545e1a31e22b542aa233b4427de..4a1c1e7706838a675256a51bd4f63edc0f80a376 100644 (file)
Binary files a/test/fixtures/controller.radar/borderColor/scriptable.png and b/test/fixtures/controller.radar/borderColor/scriptable.png differ
index 715c582e38a253a580240eb89fdd54aacc04c93e..486d1009dc5f45fd0f4c081ae72d8c70b2ce409c 100644 (file)
Binary files a/test/fixtures/controller.radar/borderColor/value.png and b/test/fixtures/controller.radar/borderColor/value.png differ
index 73d3493e24841e58ed5cbe7e7c8e5160748379c7..fbadc1a7bc356abe051ad051fd721038562df430 100644 (file)
Binary files a/test/fixtures/controller.radar/borderWidth/indexable.png and b/test/fixtures/controller.radar/borderWidth/indexable.png differ
index 2fccea7488dddb700ec6f7d5a04b91be7478ec7f..16bbfa5613e04498fce95bb959d79dea79e07707 100644 (file)
Binary files a/test/fixtures/controller.radar/borderWidth/scriptable.png and b/test/fixtures/controller.radar/borderWidth/scriptable.png differ
index ebaf659e3eba265f0621bddfaa406b97222dfb57..870b2a9431c46c8fe16783b4b02c972dbbbb3f70 100644 (file)
Binary files a/test/fixtures/controller.radar/borderWidth/value.png and b/test/fixtures/controller.radar/borderWidth/value.png differ
index 3182e522a9e83ec867b43cad9ae9256cc92b4779..c8e040214555bc292d68beb59a648f7c5028a449 100644 (file)
Binary files a/test/fixtures/controller.radar/pointStyle/indexable.png and b/test/fixtures/controller.radar/pointStyle/indexable.png differ
index 654d4ed825742b622588b89dd774567afe1df677..b30deb2d7cbaad47c9f535763204e2d70c96cc14 100644 (file)
Binary files a/test/fixtures/controller.radar/pointStyle/value.png and b/test/fixtures/controller.radar/pointStyle/value.png differ
index cbe5b11ba693cc199d172e6e0faaa5a97d9b9ee5..e6c982f3bb5f28c9a86de41842531f52e36b8209 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 5022cf0e8a087af29fbd9209b56033b5d6bf1f95..2018e4822f097357727a1715a49c12ac3d332e39 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 0e0184e27dc5abab333eddcc8ffb0f8de8213424..af50665f5de49d58a4d8e836a710b75adc16c36b 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 4dde04f2d6f0edcd9f06ffc3b21f4b21811a9fe1..e5c4b2f800927f793a48a177e16def1a2659a727 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 024ba5f2c4922ca7eb33269805cc10cde057ae44..0cc32b4a93aaaf6d6bcfa37f396b00c51e98c624 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 5048a0fdac9965f8d6eb8677dfe74d32c2f0fcc5..aec9f5112287e8636a1fd6183040ff090634d79a 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 1801c9a68a92294b5e0cc508ca5e7b7f6fc50e44..fcd44ad853a5c004fc42e7cd2460c16a9f171316 100644 (file)
@@ -5,13 +5,13 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(0, 0, 192, 0.25)",
-                "data": ["NaN", "NaN", 2, 4, 2, 1, -1, 1, 2]
+                "data": [null, null, 2, 4, 2, 1, -1, 1, 2]
             }, {
                 "backgroundColor": "rgba(0, 192, 0, 0.25)",
-                "data": [4, 2, "NaN", 3, 2.5, "NaN", -2, 1.5, 3]
+                "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, "NaN", "NaN"]
+                "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]
index 0ce6d938727752cfabfd3d9e290b0da3a3ed9204..a7f5fb658a7ccf4b567287559f39fd822406714d 100644 (file)
@@ -5,11 +5,11 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(255, 0, 0, 0.25)",
-                "data": ["NaN", "NaN", 0, -1, 0, 1, 0, -1, 0],
+                "data": [null, null, 0, -1, 0, 1, 0, -1, 0],
                 "fill": 1
             }, {
                 "backgroundColor": "rgba(0, 255, 0, 0.25)",
-                "data": [1, 0, "NaN", 1, 0, "NaN", -1, 0, 1],
+                "data": [1, 0, null, 1, 0, null, -1, 0, 1],
                 "fill": "+1"
             }, {
                 "backgroundColor": "rgba(0, 0, 255, 0.25)",
index 32f09a703ca9804af2360b298ec5a042356d2b18..ecae77e4b83e7ea1fee4820b9a53c62143d2c4e8 100644 (file)
@@ -5,11 +5,11 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(255, 0, 0, 0.25)",
-                "data": ["NaN", "NaN", 0, -1, 0, 1, 0, -1, 0],
+                "data": [null, null, 0, -1, 0, 1, 0, -1, 0],
                 "fill": 1
             }, {
                 "backgroundColor": "rgba(0, 255, 0, 0.25)",
-                "data": [1, 0, "NaN", 1, 0, "NaN", -1, 0, 1],
+                "data": [1, 0, null, 1, 0, null, -1, 0, 1],
                 "fill": "+1"
             }, {
                 "backgroundColor": "rgba(0, 0, 255, 0.25)",
index b0f40bc1212cd7b4b9c4935598a569860d3bae5e..69a6df8086801f5965cb7b0b1e6384b1d25abf72 100644 (file)
@@ -5,11 +5,11 @@
             "labels": ["0", "1", "2", "3", "4", "5", "6", "7", "8"],
             "datasets": [{
                 "backgroundColor": "rgba(255, 0, 0, 0.25)",
-                "data": ["NaN", "NaN", 0, -1, 0, 1, 0, -1, 0],
+                "data": [null, null, 0, -1, 0, 1, 0, -1, 0],
                 "fill": 1
             }, {
                 "backgroundColor": "rgba(0, 255, 0, 0.25)",
-                "data": [1, 0, "NaN", 1, 0, "NaN", -1, 0, 1],
+                "data": [1, 0, null, 1, 0, null, -1, 0, 1],
                 "fill": "+1"
             }, {
                 "backgroundColor": "rgba(0, 0, 255, 0.25)",