]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Restore `datasets` namespace (revert 6955) (#8090)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Tue, 24 Nov 2020 20:27:51 +0000 (22:27 +0200)
committerGitHub <noreply@github.com>
Tue, 24 Nov 2020 20:27:51 +0000 (22:27 +0200)
14 files changed:
docs/docs/configuration/index.md
docs/docs/getting-started/v3-migration.md
src/core/core.config.js
src/core/core.datasetController.js
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-stacked.json
test/fixtures/controller.bar/stacking/logarithmic-strings.js
test/fixtures/controller.bar/stacking/logarithmic.js
test/fixtures/plugin.filler/fill-line-dataset-interpolated.js
test/specs/controller.bar.tests.js
test/specs/controller.line.tests.js

index 3b20c090fdeea15b61012b906148e20ba301438d..68f161fe19d3ce15e3c9e0daaea50fc8c1e97df0 100644 (file)
@@ -39,7 +39,7 @@ var chartDifferentHoverMode = new Chart(ctx, {
 Options may be configured directly on the dataset. The dataset options can be changed at 3 different levels and are evaluated with the following priority:
 
 - per dataset: dataset.*
-- per chart: options[type].datasets.*
+- per chart: options.datasets[type].*
 - or globally: Chart.defaults.controllers[type].datasets.*
 
 where type corresponds to the dataset type.
index f7d59f3015277ed8e3192a8f4341fe213fb7b0cc..4e8c08d7b811f9f6311aed86dd76ab45f0870fcd 100644 (file)
@@ -91,7 +91,6 @@ A number of changes were made to the configuration options passed to the `Chart`
 * `scales.[x/y]Axes.zeroLine*` options of axes were removed. Use scriptable scale options instead.
 * The dataset option `steppedLine` was removed. Use `stepped`
 * The chart option `showLines` was renamed to `showLine` to match the dataset option.
-* Dataset options are now configured as `options[type].datasets` rather than `options.datasets[type]`
 * To override the platform class used in a chart instance, pass `platform: PlatformClass` in the config object. Note that the class should be passed, not an instance of the class.
 * `aspectRatio` defaults to 1 for doughnut, pie, polarArea, and radar charts
 * `TimeScale` does not read `t` from object data by default anymore. The default property is `x` or `y`, depending on the orientation. See [data structures](../general/data-structures.md) for details on how to change the default.
index 2f0c1dd89d2b5245f4b5bb895538101facc16785..b843615375d259d9515a225b55bd5686bf1adb3e 100644 (file)
@@ -4,9 +4,9 @@ import {mergeIf, merge, _merger} from '../helpers/helpers.core';
 export function getIndexAxis(type, options) {
        const typeDefaults = defaults.controllers[type] || {};
        const datasetDefaults = typeDefaults.datasets || {};
-       const typeOptions = options[type] || {};
-       const datasetOptions = typeOptions.datasets || {};
-       return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';
+       const datasetOptions = options.datasets || {};
+       const typeOptions = datasetOptions[type] || {};
+       return typeOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';
 }
 
 function getAxisFromDefaultScaleID(id, indexAxis) {
index d7bfab12b469d0e1d87df64b1810de1a82f54d76..bbd98de471438a4f7c58c6b3f1ff5441adf50b23 100644 (file)
@@ -396,7 +396,7 @@ export default class DatasetController {
                const me = this;
                me._config = merge(Object.create(null), [
                        defaults.controllers[me._type].datasets,
-                       (me.chart.options[me._type] || {}).datasets,
+                       (me.chart.options.datasets || {})[me._type],
                        me.getDataset(),
                ], {
                        merger(key, target, source) {
index 3cf2e7df684f6255219ee26156b723ace3d19912..d9e77a28df9233fdaefb503e670a7bfd52dd4b4c 100644 (file)
@@ -16,8 +16,8 @@
         },
         "options": {
             "responsive": false,
-            "bar": {
-                "datasets": {
+            "datasets": {
+              "bar": {
                     "barPercentage": 1,
                     "categoryPercentage": 1
                 }
index 0849b850cf7e1935450da8f612279214752c7607..c3e21c04dcae424844d57d03567cf70c4415812e 100644 (file)
@@ -16,8 +16,8 @@
         },
         "options": {
             "responsive": false,
-            "bar": {
-                "datasets": {
+            "datasets": {
+              "bar": {
                     "barPercentage": 1,
                     "categoryPercentage": 1
                 }
index 574f3abb680d548e32bccbc40a4ed6d631995e1d..7fee6650984fc20934d2917ef471a308fd9b60cb 100644 (file)
@@ -16,8 +16,8 @@
         },
         "options": {
             "responsive": false,
-            "bar": {
-                "datasets": {
+            "datasets": {
+              "bar": {
                     "barPercentage": 1,
                     "categoryPercentage": 1
                 }
index 6ae340f83b4824f0fe40319231a8e03351149070..eb004a27f2cb2ee0544b42bb2697d95009d90ad8 100644 (file)
@@ -16,8 +16,8 @@
         },
         "options": {
             "responsive": false,
-            "bar": {
-                "datasets": {
+            "datasets": {
+              "bar": {
                     "barPercentage": 1,
                     "categoryPercentage": 1
                 }
index ddf4ff868449daa47f15532e3795c509783493c8..807e964a41d39fea86af706de2ae17d277591787 100644 (file)
@@ -16,8 +16,8 @@
         },
         "options": {
             "responsive": false,
-            "bar": {
-                "datasets": {
+            "datasets": {
+              "bar": {
                     "barPercentage": 1,
                     "categoryPercentage": 1
                 }
index aa92af956bc58713eb372ed8be71d6436740703c..43763f67acd608771861dd52c66cbe07474623b0 100644 (file)
@@ -12,8 +12,8 @@ module.exports = {
                        labels: ['label1', 'label2', 'label3', 'label4']
                },
                options: {
-                       bar: {
-                               datasets: {
+                       datasets: {
+                               bar: {
                                        barPercentage: 1,
                                }
                        },
index 9e594c277ef97da05929750010632dbf61b16d43..a18911fed02a48add0bd54bf500b355d8c4cbb0d 100644 (file)
@@ -12,8 +12,8 @@ module.exports = {
                        labels: ['label1', 'label2', 'label3', 'label4']
                },
                options: {
-                       bar: {
-                               datasets: {
+                       datasets: {
+                               bar: {
                                        barPercentage: 1,
                                }
                        },
index 899da0a23f8021033f147b3609aa1d130cde5e7c..c2cbc845ab3e8f80403d3a1d910d732f94cdff26 100644 (file)
@@ -39,8 +39,8 @@ module.exports = {
                options: {
                        animation: false,
                        responsive: false,
-                       line: {
-                               datasets: {
+                       datasets: {
+                               line: {
                                        tension: 0.4,
                                        borderWidth: 1,
                                        pointRadius: 1.5,
index 6cbd36782d485eed790ca0a493d66be6928d9152..47ab800b99f58d3cd5da2d43f0735598eaa14aeb 100644 (file)
@@ -1436,8 +1436,8 @@ describe('Chart.controllers.bar', function() {
                                                options: {
                                                        legend: false,
                                                        title: false,
-                                                       bar: {
-                                                               datasets: {
+                                                       datasets: {
+                                                               bar: {
                                                                        barThickness: barThickness
                                                                }
                                                        },
index fa2e87eb1d5d530cd765fef32f9184f494a8ee5e..004dc4a6cd910ef5f26eec84ab8f98f11dd5103c 100644 (file)
@@ -570,8 +570,8 @@ describe('Chart.controllers.line', function() {
                                        labels: ['label1', 'label2']
                                },
                                options: {
-                                       line: {
-                                               datasets: {
+                                       datasets: {
+                                               line: {
                                                        tension: 0.345,
                                                        backgroundColor: '#add'
                                                }
@@ -601,8 +601,8 @@ describe('Chart.controllers.line', function() {
                                labels: ['label1', 'label2']
                        },
                        options: {
-                               line: {
-                                       datasets: {
+                               datasets: {
+                                       line: {
                                                spanGaps: true,
                                                tension: 0.231,
                                                backgroundColor: '#add',