]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix line / non-numeric-y (#6617) 6618/head
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sun, 27 Oct 2019 19:05:23 +0000 (21:05 +0200)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sun, 27 Oct 2019 19:05:23 +0000 (15:05 -0400)
src/controllers/controller.line.js
test/fixtures/controller.line/non-numeric-y.json [new file with mode: 0644]
test/fixtures/controller.line/non-numeric-y.png [new file with mode: 0644]

index dc1fc689b24250071aa6b5dca842100b1a5d776d..47adc08010cf2c12346be20f882c5a1914c781c0 100644 (file)
@@ -209,8 +209,9 @@ module.exports = DatasetController.extend({
                        if (rightValue < 0) {
                                return yScale.getPixelForValue(sumNeg + rightValue);
                        }
+                       return yScale.getPixelForValue(sumPos + rightValue);
                }
-               return yScale.getPixelForValue(sumPos + rightValue);
+               return yScale.getPixelForValue(value);
        },
 
        updateBezierControlPoints: function() {
diff --git a/test/fixtures/controller.line/non-numeric-y.json b/test/fixtures/controller.line/non-numeric-y.json
new file mode 100644 (file)
index 0000000..db5f3c3
--- /dev/null
@@ -0,0 +1,34 @@
+{
+    "config": {
+        "type": "line",
+        "data": {
+            "xLabels": ["January", "February", "March", "April", "May", "June", "July"],
+            "yLabels": ["", "Request Added", "Request Viewed", "Request Accepted", "Request Solved", "Solving Confirmed"],
+            "datasets": [{
+                "label": "My First dataset",
+                "data": ["", "Request Added", "Request Added", "Request Added", "Request Viewed", "Request Viewed", "Request Viewed"],
+                "fill": false,
+                "borderColor": "red",
+                "backgroundColor": "red"
+            }]
+        },
+        "options": {
+            "responsive": false,
+            "legend": false,
+            "title": false,
+            "scales": {
+                "xAxes": [{"display": false}],
+                "yAxes": [{
+                    "type": "category",
+                    "display": false
+                }]
+            }
+        }
+    },
+    "options": {
+        "canvas": {
+            "height": 256,
+            "width": 512
+        }
+    }
+}
diff --git a/test/fixtures/controller.line/non-numeric-y.png b/test/fixtures/controller.line/non-numeric-y.png
new file mode 100644 (file)
index 0000000..5ebecd5
Binary files /dev/null and b/test/fixtures/controller.line/non-numeric-y.png differ