From: Akihiko Kusanagi Date: Tue, 21 May 2019 09:50:38 +0000 (+0800) Subject: Treat null as NaN in radialLinear scale (#6282) X-Git-Tag: v2.9.0~1^2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03a3199306ade1253bcdc0c84d009d16059ce4a4;p=thirdparty%2FChart.js.git Treat null as NaN in radialLinear scale (#6282) --- diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index b3922f522..55b23d6d0 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -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 diff --git a/test/fixtures/controller.radar/backgroundColor/indexable.png b/test/fixtures/controller.radar/backgroundColor/indexable.png index 6141ca801..4c7bc8f0b 100644 Binary files a/test/fixtures/controller.radar/backgroundColor/indexable.png and b/test/fixtures/controller.radar/backgroundColor/indexable.png differ diff --git a/test/fixtures/controller.radar/backgroundColor/scriptable.png b/test/fixtures/controller.radar/backgroundColor/scriptable.png index b1e6d6e5a..e82a84f65 100644 Binary files a/test/fixtures/controller.radar/backgroundColor/scriptable.png and b/test/fixtures/controller.radar/backgroundColor/scriptable.png differ diff --git a/test/fixtures/controller.radar/backgroundColor/value.png b/test/fixtures/controller.radar/backgroundColor/value.png index dd7f6de6d..da08c0e44 100644 Binary files a/test/fixtures/controller.radar/backgroundColor/value.png and b/test/fixtures/controller.radar/backgroundColor/value.png differ diff --git a/test/fixtures/controller.radar/borderColor/indexable.png b/test/fixtures/controller.radar/borderColor/indexable.png index 00fe42652..e4477851c 100644 Binary files a/test/fixtures/controller.radar/borderColor/indexable.png and b/test/fixtures/controller.radar/borderColor/indexable.png differ diff --git a/test/fixtures/controller.radar/borderColor/scriptable.png b/test/fixtures/controller.radar/borderColor/scriptable.png index ea9bb5c30..4a1c1e770 100644 Binary files a/test/fixtures/controller.radar/borderColor/scriptable.png and b/test/fixtures/controller.radar/borderColor/scriptable.png differ diff --git a/test/fixtures/controller.radar/borderColor/value.png b/test/fixtures/controller.radar/borderColor/value.png index 715c582e3..486d1009d 100644 Binary files a/test/fixtures/controller.radar/borderColor/value.png and b/test/fixtures/controller.radar/borderColor/value.png differ diff --git a/test/fixtures/controller.radar/borderWidth/indexable.png b/test/fixtures/controller.radar/borderWidth/indexable.png index 73d3493e2..fbadc1a7b 100644 Binary files a/test/fixtures/controller.radar/borderWidth/indexable.png and b/test/fixtures/controller.radar/borderWidth/indexable.png differ diff --git a/test/fixtures/controller.radar/borderWidth/scriptable.png b/test/fixtures/controller.radar/borderWidth/scriptable.png index 2fccea748..16bbfa561 100644 Binary files a/test/fixtures/controller.radar/borderWidth/scriptable.png and b/test/fixtures/controller.radar/borderWidth/scriptable.png differ diff --git a/test/fixtures/controller.radar/borderWidth/value.png b/test/fixtures/controller.radar/borderWidth/value.png index ebaf659e3..870b2a943 100644 Binary files a/test/fixtures/controller.radar/borderWidth/value.png and b/test/fixtures/controller.radar/borderWidth/value.png differ diff --git a/test/fixtures/controller.radar/pointStyle/indexable.png b/test/fixtures/controller.radar/pointStyle/indexable.png index 3182e522a..c8e040214 100644 Binary files a/test/fixtures/controller.radar/pointStyle/indexable.png and b/test/fixtures/controller.radar/pointStyle/indexable.png differ diff --git a/test/fixtures/controller.radar/pointStyle/value.png b/test/fixtures/controller.radar/pointStyle/value.png index 654d4ed82..b30deb2d7 100644 Binary files a/test/fixtures/controller.radar/pointStyle/value.png and b/test/fixtures/controller.radar/pointStyle/value.png differ diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-end-circular.json b/test/fixtures/plugin.filler/fill-radar-boundary-end-circular.json index cbe5b11ba..e6c982f3b 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-end-circular.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-end-circular.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-end.json b/test/fixtures/plugin.filler/fill-radar-boundary-end.json index 5022cf0e8..2018e4822 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-end.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-end.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin-circular.json b/test/fixtures/plugin.filler/fill-radar-boundary-origin-circular.json index 0e0184e27..af50665f5 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-origin-circular.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-origin-circular.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.json b/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.json index 4dde04f2d..e5c4b2f80 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-origin-spline.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-origin.json b/test/fixtures/plugin.filler/fill-radar-boundary-origin.json index 024ba5f2c..0cc32b4a9 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-origin.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-origin.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-start-circular.json b/test/fixtures/plugin.filler/fill-radar-boundary-start-circular.json index 5048a0fda..aec9f5112 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-start-circular.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-start-circular.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-boundary-start.json b/test/fixtures/plugin.filler/fill-radar-boundary-start.json index 1801c9a68..fcd44ad85 100644 --- a/test/fixtures/plugin.filler/fill-radar-boundary-start.json +++ b/test/fixtures/plugin.filler/fill-radar-boundary-start.json @@ -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] diff --git a/test/fixtures/plugin.filler/fill-radar-dataset-border.json b/test/fixtures/plugin.filler/fill-radar-dataset-border.json index 0ce6d9387..a7f5fb658 100644 --- a/test/fixtures/plugin.filler/fill-radar-dataset-border.json +++ b/test/fixtures/plugin.filler/fill-radar-dataset-border.json @@ -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)", diff --git a/test/fixtures/plugin.filler/fill-radar-dataset-spline.json b/test/fixtures/plugin.filler/fill-radar-dataset-spline.json index 32f09a703..ecae77e4b 100644 --- a/test/fixtures/plugin.filler/fill-radar-dataset-spline.json +++ b/test/fixtures/plugin.filler/fill-radar-dataset-spline.json @@ -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)", diff --git a/test/fixtures/plugin.filler/fill-radar-dataset.json b/test/fixtures/plugin.filler/fill-radar-dataset.json index b0f40bc12..69a6df808 100644 --- a/test/fixtures/plugin.filler/fill-radar-dataset.json +++ b/test/fixtures/plugin.filler/fill-radar-dataset.json @@ -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)",