]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Release v2.9.1 (#6618)
authorEvert Timberg <evert.timberg+github@gmail.com>
Sun, 27 Oct 2019 19:11:33 +0000 (15:11 -0400)
committerGitHub <noreply@github.com>
Sun, 27 Oct 2019 19:11:33 +0000 (15:11 -0400)
Release v2.9.1

22 files changed:
docs/general/README.md
package.json
src/controllers/controller.horizontalBar.js
src/controllers/controller.line.js
src/core/core.scale.js
test/fixtures/controller.bar/bar-thickness-absolute.json
test/fixtures/controller.bar/bar-thickness-flex-offset.json
test/fixtures/controller.bar/bar-thickness-flex-single-reverse.json
test/fixtures/controller.bar/bar-thickness-flex-single.json
test/fixtures/controller.bar/bar-thickness-flex.json
test/fixtures/controller.bar/bar-thickness-max.json
test/fixtures/controller.bar/bar-thickness-min-interval.json
test/fixtures/controller.bar/bar-thickness-multiple.json
test/fixtures/controller.bar/bar-thickness-no-overlap.json
test/fixtures/controller.bar/bar-thickness-offset.json
test/fixtures/controller.bar/bar-thickness-reverse.json
test/fixtures/controller.bar/bar-thickness-single-xy.json
test/fixtures/controller.bar/bar-thickness-single.json
test/fixtures/controller.bar/bar-thickness-stacked.json
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]
test/specs/controller.bar.tests.js

index 950188ff1d51c328936ab3e0412b4af341c3585a..fc4821d31f1a6bc1138b5853fb3ed94907bed95a 100644 (file)
@@ -8,3 +8,4 @@ These sections describe general configuration options that can apply elsewhere i
 * [Options](./options.md) scriptable and indexable options syntax.
 * [Colors](./colors.md) defines acceptable color values.
 * [Font](./fonts.md) defines various font options.
+* [Performance](./performance.md) gives tips for performance-sensitive applications.
index 1550d567a3709a293ecc6d5f74a96233c9a1cc4f..782dc972f2d1c6fab9b02441af3aadf986e06b05 100644 (file)
@@ -2,7 +2,7 @@
   "name": "chart.js",
   "homepage": "https://www.chartjs.org",
   "description": "Simple HTML5 charts using the canvas element.",
-  "version": "2.9.0",
+  "version": "2.9.1",
   "license": "MIT",
   "jsdelivr": "dist/Chart.min.js",
   "unpkg": "dist/Chart.min.js",
index ebfc6d84ae1efe12fd280582436feafedc45e981..7b11bcc6627f68f7f4befbab37232d1abdb4cd21 100644 (file)
@@ -18,8 +18,6 @@ defaults._set('horizontalBar', {
                yAxes: [{
                        type: 'category',
                        position: 'left',
-                       categoryPercentage: 0.8,
-                       barPercentage: 0.9,
                        offset: true,
                        gridLines: {
                                offsetGridLines: true
@@ -39,6 +37,15 @@ defaults._set('horizontalBar', {
        }
 });
 
+defaults._set('global', {
+       datasets: {
+               horizontalBar: {
+                       categoryPercentage: 0.8,
+                       barPercentage: 0.9
+               }
+       }
+});
+
 module.exports = BarController.extend({
        /**
         * @private
@@ -54,4 +61,3 @@ module.exports = BarController.extend({
                return this.getMeta().yAxisID;
        }
 });
-
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() {
index f292bd2c2e5c56016bcf1cb7d451a45d2e217dd2..914bdefaae1ae0a93442768fcffaa14568fad805 100644 (file)
@@ -929,7 +929,7 @@ var Scale = Element.extend({
 
        getDecimalForPixel: function(pixel) {
                var decimal = (pixel - this._startPixel) / this._length;
-               return Math.min(1, Math.max(0, this._reversePixels ? 1 - decimal : decimal));
+               return this._reversePixels ? 1 - decimal : decimal;
        },
 
        /**
index 58b6e1132444dcc9aed42bb4baa094f9555e6f6e..4c5ed53391d9c13d8609c47df3a93519f2f1fcd3 100644 (file)
@@ -5,6 +5,9 @@
             "labels": ["2017", "2018", "2019", "2024", "2025"],
             "datasets": [{
                 "backgroundColor": "rgba(255, 99, 132, 0.5)",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
+                "barThickness": 128,
                 "data": [1, null, 3, 4, 5]
             }]
         },
@@ -17,9 +20,6 @@
                     "type": "time",
                     "offset": true,
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
-                    "barThickness": 128,
                     "time": {
                         "parser": "YYYY"
                     },
index 6b0829dd5613f06fe1948fc53a9de379af593dc9..6672516e472274dd0c6179322181aeb376ad8162 100644 (file)
@@ -5,6 +5,9 @@
             "labels": ["2017", "2018", "2020", "2024", "2038"],
             "datasets": [{
                 "backgroundColor": "#FF6384",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
+                "barThickness": "flex",
                 "data": [1, null, 3, 4, 5]
             }]
         },
@@ -17,9 +20,6 @@
                     "type": "time",
                     "offset": true,
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
-                    "barThickness": "flex",
                     "time": {
                         "parser": "YYYY"
                     },
index 6f63ca93468370335110a67d0072e5062103115f..e6d1237366651d9ff51e3a505a1300e5e6dd0e09 100644 (file)
@@ -5,6 +5,9 @@
             "labels": ["2016", "2018", "2020", "2024", "2030"],
             "datasets": [{
                 "backgroundColor": "#FF6384",
+                "barThickness": "flex",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
                 "data": [1]
             }]
         },
@@ -16,9 +19,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barThickness": "flex",
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index f523f4f5fc6113d94d2c2d105d7c7ba2e179fb63..a59b2aff8022a913bba3d674c03e9dc734e25358 100644 (file)
@@ -5,6 +5,9 @@
             "labels": ["2016", "2018", "2020", "2024", "2030"],
             "datasets": [{
                 "backgroundColor": "#FF6384",
+                "barThickness": "flex",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
                 "data": [1]
             }]
         },
@@ -16,9 +19,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barThickness": "flex",
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index c800a0af0673925943d04f192689349735a0e95e..b9048faed0aa05f79b2923b80d9e85d7586f8a2b 100644 (file)
@@ -5,6 +5,9 @@
             "labels": ["2017", "2018", "2020", "2024", "2038"],
             "datasets": [{
                 "backgroundColor": "#FF6384",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
+                "barThickness": "flex",
                 "data": [1, null, 3, 4, 5]
             }]
         },
@@ -16,9 +19,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
-                    "barThickness": "flex",
                     "time": {
                         "parser": "YYYY"
                     },
index 3430b8c93900f1c5a9c643030760866b202a12ad..2ca185516bca350e85ccab68f936e26820e2edc8 100644 (file)
@@ -5,6 +5,9 @@
             "labels": ["2016", "2018", "2020", "2024", "2030"],
             "datasets": [{
                 "backgroundColor": "#FF6384",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
+                "maxBarThickness": 8,
                 "data": [1, null, 3, 4, 5]
             }]
         },
@@ -16,9 +19,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
-                    "maxBarThickness": 8,
                     "time": {
                         "parser": "YYYY"
                     },
index 41fd8676a450c425be7f53b02a96d36259fd4117..954e15cfdf64f2b2e8375184c09a547c7882d01c 100644 (file)
@@ -5,6 +5,8 @@
             "labels": ["2016", "2018", "2020", "2024", "2030"],
             "datasets": [{
                 "backgroundColor": "#FF6384",
+                "barPercentage": 1,
+                "categoryPercentage": 1,
                 "data": [1, null, 3, 4, 5]
             }]
         },
@@ -16,8 +18,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index 3dcddaff0e7c8afb429c12f92b040e182e9af9e8..f26a395fb4dca22ae47cd2991d6123b936ee0b8b 100644 (file)
             "responsive": false,
             "legend": false,
             "title": false,
+            "datasets": {
+                "bar": {
+                    "barPercentage": 1,
+                    "categoryPercentage": 1
+                }
+            },
             "scales": {
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index 9b06e512718e4b014b58c8f8432a440a8777b1dc..2bfee4436c659dc07cff331139b80188c65976b6 100644 (file)
             "responsive": false,
             "legend": false,
             "title": false,
+            "datasets": {
+                "bar": {
+                    "barPercentage": 1,
+                    "categoryPercentage": 1
+                }
+            },
             "scales": {
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY-MM"
                     },
index 78ff4e2dd9c83e92fc93f20878bbdc2de337ed77..8785569570b07bcbae444d0969e479ffaafe2db6 100644 (file)
             "responsive": false,
             "legend": false,
             "title": false,
+            "datasets": {
+                "bar": {
+                    "barPercentage": 1,
+                    "categoryPercentage": 1
+                }
+            },
             "scales": {
                 "xAxes": [{
                     "type": "time",
                     "offset": true,
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index 5e868370f75ebe51b51fd417390c4ed5f0105968..215858dd8b7ceae1a805dc811e9487842ee7e205 100644 (file)
             "responsive": false,
             "legend": false,
             "title": false,
+            "datasets": {
+                "bar": {
+                    "barPercentage": 1,
+                    "categoryPercentage": 1
+                }
+            },
             "scales": {
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index 20446e80887f1666b0365ec5da4211664165b2f1..68a99a908533b6fc58c697b8191ad71afc788497 100644 (file)
@@ -4,6 +4,8 @@
         "data": {
             "labels": ["2016", "2018", "2020", "2024", "2030"],
             "datasets": [{
+                "barPercentage": 1,
+                "categoryPercentage": 1,
                 "backgroundColor": "#FF6384",
                 "data": [{"x": "2022", "y": 42}]
             }]
@@ -16,8 +18,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index 59e5fcb9a908ec0d561e190f80d8a8a38c61efd1..1b6565ed0a259e21bd7666e7f3fbd906a3e021ae 100644 (file)
@@ -4,6 +4,8 @@
         "data": {
             "labels": ["2016", "2018", "2020", "2024", "2030"],
             "datasets": [{
+                "barPercentage": 1,
+                "categoryPercentage": 1,
                 "backgroundColor": "#FF6384",
                 "data": [1]
             }]
@@ -16,8 +18,6 @@
                 "xAxes": [{
                     "type": "time",
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
index effb2f4fb713aa61e48a21db0fb5812f3180f372..3c9f01c2867ea7e74c499683078bc20995715cbb 100644 (file)
             "responsive": false,
             "legend": false,
             "title": false,
+            "datasets": {
+                "bar": {
+                    "barPercentage": 1,
+                    "categoryPercentage": 1
+                }
+            },
             "scales": {
                 "xAxes": [{
                     "type": "time",
                     "stacked": true,
                     "display": false,
-                    "barPercentage": 1,
-                    "categoryPercentage": 1,
                     "time": {
                         "parser": "YYYY"
                     },
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
index 3874c3325df88295d2512b6ddfa50402935f1bc9..49b586fd81eb00274f53cdea65cf7d5d9cf6d14b 100644 (file)
@@ -1214,12 +1214,16 @@ describe('Chart.controllers.bar', function() {
                        options: {
                                legend: false,
                                title: false,
+                               datasets: {
+                                       bar: {
+                                               barPercentage: 1,
+                                       }
+                               },
                                scales: {
                                        xAxes: [{
                                                type: 'category',
                                                display: false,
                                                stacked: true,
-                                               barPercentage: 1,
                                        }],
                                        yAxes: [{
                                                type: 'logarithmic',
@@ -1275,12 +1279,16 @@ describe('Chart.controllers.bar', function() {
                        options: {
                                legend: false,
                                title: false,
+                               datasets: {
+                                       bar: {
+                                               barPercentage: 1,
+                                       }
+                               },
                                scales: {
                                        xAxes: [{
                                                type: 'category',
                                                display: false,
                                                stacked: true,
-                                               barPercentage: 1,
                                        }],
                                        yAxes: [{
                                                type: 'logarithmic',
@@ -1593,8 +1601,9 @@ describe('Chart.controllers.bar', function() {
                        var meta = chart.getDatasetMeta(0);
                        var yScale = chart.scales[meta.yAxisID];
 
-                       var categoryPercentage = yScale.options.categoryPercentage;
-                       var barPercentage = yScale.options.barPercentage;
+                       var config = meta.controller._config;
+                       var categoryPercentage = config.categoryPercentage;
+                       var barPercentage = config.barPercentage;
                        var stacked = yScale.options.stacked;
 
                        var totalBarHeight = 0;
@@ -1669,11 +1678,15 @@ describe('Chart.controllers.bar', function() {
                                                options: {
                                                        legend: false,
                                                        title: false,
+                                                       datasets: {
+                                                               bar: {
+                                                                       barThickness: barThickness
+                                                               }
+                                                       },
                                                        scales: {
                                                                xAxes: [{
                                                                        id: 'x',
                                                                        type: 'category',
-                                                                       barThickness: barThickness
                                                                }],
                                                                yAxes: [{
                                                                        type: 'linear',