]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Relocate dataset defaults to defaults.controllers (#7979)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Fri, 30 Oct 2020 22:34:32 +0000 (00:34 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Oct 2020 22:34:32 +0000 (18:34 -0400)
18 files changed:
docs/docs/charts/bar.mdx
docs/docs/charts/doughnut.mdx
docs/docs/charts/line.mdx
docs/docs/charts/polar.mdx
docs/docs/charts/radar.mdx
docs/docs/configuration/index.md
docs/docs/getting-started/v3-migration.md
samples/charts/multi-series-pie.html
src/core/core.config.js
src/core/core.controller.js
src/core/core.datasetController.js
src/core/core.registry.js
test/specs/controller.bar.tests.js
test/specs/controller.line.tests.js
test/specs/core.controller.tests.js
test/specs/core.registry.tests.js
test/specs/global.defaults.tests.js
test/specs/platform.dom.tests.js

index 2a96460a1feb0589884c74b33d474ffb139258d3..738931ab37695eba4bf62bd185ab941f36fbfd7e 100644 (file)
@@ -79,7 +79,7 @@ the color of the bars is generally set this way.
 | Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
 | ---- | ---- | :----: | :----: | ----
 | [`backgroundColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
-| [`base`](#general) | `number` | Yes | Yes | 
+| [`base`](#general) | `number` | Yes | Yes |
 | [`borderColor`](#styling) | [`Color`](../general/colors.md) | Yes | Yes | `'rgba(0, 0, 0, 0.1)'`
 | [`borderSkipped`](#borderskipped) | `string` | Yes | Yes | `'start'`
 | [`borderWidth`](#borderwidth) | <code>number&#124;object</code> | Yes | Yes | `0`
@@ -234,7 +234,7 @@ If true, the bars for a particular data point fall between the grid lines. The g
 
 ## Default Options
 
-It is common to want to apply a configuration setting to all created bar charts. The global bar chart settings are stored in `Chart.defaults.bar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
+It is common to want to apply a configuration setting to all created bar charts. The global bar chart settings are stored in `Chart.defaults.controllers.bar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
 
 ## barPercentage vs categoryPercentage
 
index 1b95d5dea6cb205d9c008409521db257b1b9a82d..920dc8a9593ba999aad1bc1241fea71b6bb26092 100644 (file)
@@ -169,7 +169,7 @@ These are the customisation options specific to Pie & Doughnut charts. These opt
 
 ## Default Options
 
-We can also change these default values for each Doughnut type that is created, this object is available at `Chart.defaults.doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.defaults.pie`, with the only difference being `cutoutPercentage` being set to 0.
+We can also change these default values for each Doughnut type that is created, this object is available at `Chart.defaults.controllers.doughnut`. Pie charts also have a clone of these defaults available to change at `Chart.defaults.controllers.pie`, with the only difference being `cutoutPercentage` being set to 0.
 
 ## Data Structure
 
index 100e935e3b4b72563876e571b932e6414fe9e7b4..65edb6127c4a41fdc3e52190be1ec3d99badf6c3 100644 (file)
@@ -184,12 +184,12 @@ The line chart defines the following configuration options. These options are me
 
 ## Default Options
 
-It is common to want to apply a configuration setting to all created line charts. The global line chart settings are stored in `Chart.defaults.line`. Changing the global options only affects charts created after the change. Existing charts are not changed.
+It is common to want to apply a configuration setting to all created line charts. The global line chart settings are stored in `Chart.defaults.controllers.line`. Changing the global options only affects charts created after the change. Existing charts are not changed.
 
 For example, to configure all line charts with `spanGaps = true` you would do:
 
 ```javascript
-Chart.defaults.line.spanGaps = true;
+Chart.defaults.controllers.line.spanGaps = true;
 ```
 
 ## Data Structure
index 04899c01f5927a37cf8ebea226056a0522e8050e..680a620a3aee52bad1c45cbb0de5cb97bd598a1b 100644 (file)
@@ -119,12 +119,12 @@ The polar area chart uses the [radialLinear](../axes/radial/linear.md) scale. Ad
 
 ## Default Options
 
-We can also change these default values for each PolarArea type that is created, this object is available at `Chart.defaults.polarArea`. Changing the global options only affects charts created after the change. Existing charts are not changed.
+We can also change these default values for each PolarArea type that is created, this object is available at `Chart.defaults.controllers.polarArea`. Changing the global options only affects charts created after the change. Existing charts are not changed.
 
 For example, to configure all new polar area charts with `animateScale = false` you would do:
 
 ```javascript
-Chart.defaults.polarArea.animation.animateScale = false;
+Chart.defaults.controllers.polarArea.animation.animateScale = false;
 ```
 
 ## Data Structure
index ee8a8d6449b73ccb2bacedc7fb06b50df566ded1..9086aed4fa1ded1c30ab8082003bfba2d97c752a 100644 (file)
@@ -191,7 +191,7 @@ options = {
 
 ## Default Options
 
-It is common to want to apply a configuration setting to all created radar charts. The global radar chart settings are stored in `Chart.defaults.radar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
+It is common to want to apply a configuration setting to all created radar charts. The global radar chart settings are stored in `Chart.defaults.controllers.radar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
 
 ## Data Structure
 
index d43b2c974dbeb4a3108307e1a2b9b4f09385d651..3b20c090fdeea15b61012b906148e20ba301438d 100644 (file)
@@ -40,7 +40,7 @@ Options may be configured directly on the dataset. The dataset options can be ch
 
 - per dataset: dataset.*
 - per chart: options[type].datasets.*
-- or globally: Chart.defaults[type].datasets.*
+- or globally: Chart.defaults.controllers[type].datasets.*
 
 where type corresponds to the dataset type.
 
index ee6c68499531f3e8615c07211c48682bb0f5e9f1..8e908567806a7b74a843f25369b2721630ad0bd1 100644 (file)
@@ -100,6 +100,7 @@ A number of changes were made to the configuration options passed to the `Chart`
 #### Defaults
 
 * `global` namespace was removed from `defaults`. So `Chart.defaults.global` is now `Chart.defaults`
+* Dataset controller defaults were relocate to `controllers`. For example `Chart.defaults.line` is now `Chart.defaults.controllers.line`
 * `default` prefix was removed from defaults. For example `Chart.defaults.global.defaultColor` is now `Chart.defaults.color`
 * `defaultColor` was renamed to `color`
 * `defaultFontColor` was renamed to `font.color`
index 15347ebb70318985de5a332c1a4691b27fbc8059..4e87fc608f8e46f219d591e78ccfe614865225fb 100644 (file)
@@ -47,7 +47,7 @@
                                        labels: {
                                                generateLabels: function(chart) {
                                                        // Get the default label list
-                                                       var original = Chart.defaults.pie.legend.labels.generateLabels;
+                                                       var original = Chart.defaults.controllers.pie.legend.labels.generateLabels;
                                                        var labels = original.call(this, chart);
 
                                                        // Build an array of colors used in the datasets of the chart
@@ -92,4 +92,4 @@
        </script>
 </body>
 
-</html>
\ No newline at end of file
+</html>
index 57ebaec4e66939fe3063433a92f854e866c6ab94..4fda6e38bf32e3f6b465d09d5abe1a68fdb3640f 100644 (file)
@@ -3,7 +3,7 @@ import defaults from './core.defaults';
 import {mergeIf, merge, _merger} from '../helpers/helpers.core';
 
 export function getIndexAxis(type, options) {
-       const typeDefaults = defaults[type] || {};
+       const typeDefaults = defaults.controllers[type] || {};
        const datasetDefaults = typeDefaults.datasets || {};
        const typeOptions = options[type] || {};
        const datasetOptions = typeOptions.datasets || {};
@@ -42,7 +42,7 @@ export function determineAxis(id, scaleOptions) {
 
 function mergeScaleConfig(config, options) {
        options = options || {};
-       const chartDefaults = defaults[config.type] || {scales: {}};
+       const chartDefaults = defaults.controllers[config.type] || {scales: {}};
        const configScales = options.scales || {};
        const chartIndexAxis = getIndexAxis(config.type, options);
        const firstIDs = Object.create(null);
@@ -67,7 +67,7 @@ function mergeScaleConfig(config, options) {
        config.data.datasets.forEach(dataset => {
                const type = dataset.type || config.type;
                const indexAxis = dataset.indexAxis || getIndexAxis(type, options);
-               const datasetDefaults = defaults[type] || {};
+               const datasetDefaults = defaults.controllers[type] || {};
                const defaultScaleOptions = datasetDefaults.scales || {};
                Object.keys(defaultScaleOptions).forEach(defaultID => {
                        const axis = getAxisFromDefaultScaleID(defaultID, indexAxis);
@@ -94,7 +94,7 @@ function mergeScaleConfig(config, options) {
 function mergeConfig(...args/* config objects ... */) {
        return merge(Object.create(null), args, {
                merger(key, target, source, options) {
-                       if (key !== 'scales' && key !== 'scale') {
+                       if (key !== 'scales' && key !== 'scale' && key !== 'controllers') {
                                _merger(key, target, source, options);
                        }
                }
@@ -104,7 +104,7 @@ function mergeConfig(...args/* config objects ... */) {
 function includeDefaults(options, type) {
        return mergeConfig(
                defaults,
-               defaults[type],
+               defaults.controllers[type],
                options || {});
 }
 
index 51098c786dd36644d7191e051fa19f5ad9525d44..18849bad5431948a164dff83fe86c16995b82f86 100644 (file)
@@ -384,7 +384,7 @@ class Chart {
                                meta.controller.updateIndex(i);
                                meta.controller.linkScales();
                        } else {
-                               const controllerDefaults = defaults[type];
+                               const controllerDefaults = defaults.controllers[type];
                                const ControllerClass = registry.getController(type);
                                Object.assign(ControllerClass.prototype, {
                                        dataElementType: registry.getElement(controllerDefaults.dataElementType),
index 58a3d6ad5ec9e37db2d90526284305bd5f11dfb2..6c9dc259c1eea08a0bb2d71600fd596eb22cd624 100644 (file)
@@ -1,4 +1,5 @@
 import Animations from './core.animations';
+import defaults from './core.defaults';
 import {isObject, merge, _merger, isArray, valueOrDefault, mergeIf, resolveObjectKey, _capitalize} from '../helpers/helpers.core';
 import {listenArrayEvents, unlistenArrayEvents} from '../helpers/helpers.collection';
 import {resolve} from '../helpers/helpers.options';
@@ -335,7 +336,8 @@ export default class DatasetController {
        configure() {
                const me = this;
                me._config = merge(Object.create(null), [
-                       me.chart.options[me._type].datasets,
+                       defaults.controllers[me._type].datasets,
+                       me.chart.options[me._type]?.datasets,
                        me.getDataset(),
                ], {
                        merger(key, target, source) {
index d6f23f5d9c9ee6cd751bf64759edd6045552b960..11f4d339f434573874510a9511c3a7bbf296bdf9 100644 (file)
@@ -10,7 +10,7 @@ import {each, callback as call, _capitalize} from '../helpers/helpers.core';
  */
 export class Registry {
        constructor() {
-               this.controllers = new TypedRegistry(DatasetController, '');
+               this.controllers = new TypedRegistry(DatasetController, 'controllers');
                this.elements = new TypedRegistry(Element, 'elements');
                this.plugins = new TypedRegistry(Object, 'plugins');
                this.scales = new TypedRegistry(Scale, 'scales');
index 1f5d18909af064bf7033cca51832b1ea51fa368e..f55d274779a16ed48dbb52bbb5418b9105f8e2a1 100644 (file)
@@ -1286,7 +1286,7 @@ describe('Chart.controllers.bar', function() {
                        var chart = window.acquireChart(this.config);
                        var meta = chart.getDatasetMeta(0);
                        var xScale = chart.scales[meta.xAxisID];
-                       var options = Chart.defaults.bar.datasets;
+                       var options = Chart.defaults.controllers.bar.datasets;
 
                        var categoryPercentage = options.categoryPercentage;
                        var barPercentage = options.barPercentage;
@@ -1462,7 +1462,7 @@ describe('Chart.controllers.bar', function() {
                                                expected = barThickness;
                                        } else {
                                                var scale = chart.scales.x;
-                                               var options = Chart.defaults.bar.datasets;
+                                               var options = Chart.defaults.controllers.bar.datasets;
                                                var categoryPercentage = options.categoryPercentage;
                                                var barPercentage = options.barPercentage;
                                                var tickInterval = scale.getPixelForTick(1) - scale.getPixelForTick(0);
index d29bdc3e6863875101dcba9f8d559cf22209046b..f8249261d2df6511e77aa31dde9f04409cce3839 100644 (file)
@@ -499,18 +499,18 @@ describe('Chart.controllers.line', function() {
 
        describe('dataset global defaults', function() {
                beforeEach(function() {
-                       this._defaults = Chart.helpers.clone(Chart.defaults.line.datasets);
+                       this._defaults = Chart.helpers.clone(Chart.defaults.controllers.line.datasets);
                });
 
                afterEach(function() {
-                       Chart.defaults.line.datasets = this._defaults;
+                       Chart.defaults.controllers.line.datasets = this._defaults;
                        delete this._defaults;
                });
 
                it('should utilize the dataset global default options', function() {
-                       Chart.defaults.line.datasets = Chart.defaults.line.datasets || {};
+                       Chart.defaults.controllers.line.datasets = Chart.defaults.controllers.line.datasets || {};
 
-                       Chart.helpers.merge(Chart.defaults.line.datasets, {
+                       Chart.helpers.merge(Chart.defaults.controllers.line.datasets, {
                                spanGaps: true,
                                lineTension: 0.231,
                                backgroundColor: '#add',
@@ -551,9 +551,9 @@ describe('Chart.controllers.line', function() {
                });
 
                it('should be overriden by user-supplied values', function() {
-                       Chart.defaults.line.datasets = Chart.defaults.line.datasets || {};
+                       Chart.defaults.controllers.line.datasets = Chart.defaults.controllers.line.datasets || {};
 
-                       Chart.helpers.merge(Chart.defaults.line.datasets, {
+                       Chart.helpers.merge(Chart.defaults.controllers.line.datasets, {
                                spanGaps: true,
                                lineTension: 0.231
                        });
index aa783eb0adfb3ef647a75eae7104057f3b6faa16..5d3a5202f1ca838077639880efd2fd0e57545ac3 100644 (file)
@@ -92,11 +92,11 @@ describe('Chart', function() {
                it('should initialize config with default interaction options', function() {
                        var callback = function() {};
                        var defaults = Chart.defaults;
-                       var defaultMode = defaults.line.interaction.mode;
+                       var defaultMode = defaults.controllers.line.interaction.mode;
 
                        defaults.hover.onHover = callback;
-                       defaults.line.spanGaps = true;
-                       defaults.line.interaction.mode = 'test';
+                       defaults.controllers.line.spanGaps = true;
+                       defaults.controllers.line.interaction.mode = 'test';
 
                        var chart = acquireChart({
                                type: 'line'
@@ -104,14 +104,14 @@ describe('Chart', function() {
 
                        var options = chart.options;
                        expect(options.font.size).toBe(defaults.font.size);
-                       expect(options.showLine).toBe(defaults.line.showLine);
+                       expect(options.showLine).toBe(defaults.controllers.line.showLine);
                        expect(options.spanGaps).toBe(true);
                        expect(options.hover.onHover).toBe(callback);
                        expect(options.hover.mode).toBe('test');
 
                        defaults.hover.onHover = null;
-                       defaults.line.spanGaps = false;
-                       defaults.line.interaction.mode = defaultMode;
+                       defaults.controllers.line.spanGaps = false;
+                       defaults.controllers.line.interaction.mode = defaultMode;
                });
 
                it('should initialize config with default hover options', function() {
@@ -119,8 +119,8 @@ describe('Chart', function() {
                        var defaults = Chart.defaults;
 
                        defaults.hover.onHover = callback;
-                       defaults.line.spanGaps = true;
-                       defaults.line.hover.mode = 'test';
+                       defaults.controllers.line.spanGaps = true;
+                       defaults.controllers.line.hover.mode = 'test';
 
                        var chart = acquireChart({
                                type: 'line'
@@ -128,14 +128,14 @@ describe('Chart', function() {
 
                        var options = chart.options;
                        expect(options.font.size).toBe(defaults.font.size);
-                       expect(options.showLine).toBe(defaults.line.showLine);
+                       expect(options.showLine).toBe(defaults.controllers.line.showLine);
                        expect(options.spanGaps).toBe(true);
                        expect(options.hover.onHover).toBe(callback);
                        expect(options.hover.mode).toBe('test');
 
                        defaults.hover.onHover = null;
-                       defaults.line.spanGaps = false;
-                       delete defaults.line.hover.mode;
+                       defaults.controllers.line.spanGaps = false;
+                       delete defaults.controllers.line.hover.mode;
                });
 
                it('should override default options', function() {
@@ -143,8 +143,8 @@ describe('Chart', function() {
                        var defaults = Chart.defaults;
 
                        defaults.hover.onHover = callback;
-                       defaults.line.hover.mode = 'x-axis';
-                       defaults.line.spanGaps = true;
+                       defaults.controllers.line.hover.mode = 'x-axis';
+                       defaults.controllers.line.spanGaps = true;
 
                        var chart = acquireChart({
                                type: 'line',
@@ -166,8 +166,8 @@ describe('Chart', function() {
                        expect(options.title.position).toBe('bottom');
 
                        defaults.hover.onHover = null;
-                       delete defaults.line.hover.mode;
-                       defaults.line.spanGaps = false;
+                       delete defaults.controllers.line.hover.mode;
+                       defaults.controllers.line.spanGaps = false;
                });
 
                it('should override axis positions that are incorrect', function() {
@@ -348,7 +348,7 @@ describe('Chart', function() {
                        expect(chart.scales.x.options._jasmineCheck).toBeDefined();
                        expect(chart.scales.y.options._jasmineCheck).toBeDefined();
 
-                       expect(Chart.defaults.line._jasmineCheck).not.toBeDefined();
+                       expect(Chart.defaults.controllers.line._jasmineCheck).not.toBeDefined();
                        expect(Chart.defaults._jasmineCheck).not.toBeDefined();
                        expect(Chart.defaults.scales.linear._jasmineCheck).not.toBeDefined();
                        expect(Chart.defaults.scales.category._jasmineCheck).not.toBeDefined();
index fbc6e50b88af185d57e5fa65f60ad86b5d098fa4..8c349ab708f9e567787c710f211a3c8319447aae 100644 (file)
@@ -6,12 +6,12 @@ describe('Chart.registry', function() {
                CustomController.prototype = Object.create(Chart.controllers.line.prototype);
                CustomController.prototype.constructor = CustomController;
                CustomController.id = 'myline';
-               CustomController.defaults = Chart.defaults.line;
+               CustomController.defaults = Chart.defaults.controllers.line;
 
                Chart.register(CustomController);
 
                expect(Chart.registry.getController('myline')).toEqual(CustomController);
-               expect(Chart.defaults.myline).toEqual(CustomController.defaults);
+               expect(Chart.defaults.controllers.myline).toEqual(CustomController.defaults);
 
                Chart.unregister(CustomController);
        });
@@ -94,14 +94,14 @@ describe('Chart.registry', function() {
                Chart.register(CustomController);
 
                expect(Chart.registry.getController('custom')).toEqual(CustomController);
-               expect(Chart.defaults.custom).toEqual(CustomController.defaults);
+               expect(Chart.defaults.controllers.custom).toEqual(CustomController.defaults);
 
                Chart.unregister(CustomController);
 
                expect(function() {
                        Chart.registry.getController('custom');
                }).toThrow(new Error('"custom" is not a registered controller.'));
-               expect(Chart.defaults.custom).not.toBeDefined();
+               expect(Chart.defaults.controllers.custom).not.toBeDefined();
        });
 
        it('should handle an ES6 scale extension', function() {
@@ -120,7 +120,7 @@ describe('Chart.registry', function() {
                expect(function() {
                        Chart.registry.getScale('es6Scale');
                }).toThrow(new Error('"es6Scale" is not a registered scale.'));
-               expect(Chart.defaults.custom).not.toBeDefined();
+               expect(Chart.defaults.controllers.custom).not.toBeDefined();
        });
 
        it('should handle an ES6 element extension', function() {
@@ -190,14 +190,14 @@ describe('Chart.registry', function() {
                        Chart.registry.addControllers(customExtension);
 
                        expect(Chart.registry.getController('custom')).toEqual(customExtension);
-                       expect(Chart.defaults.custom).toEqual(customExtension.defaults);
+                       expect(Chart.defaults.controllers.custom).toEqual(customExtension.defaults);
 
                        Chart.registry.removeControllers(customExtension);
 
                        expect(function() {
                                Chart.registry.getController('custom');
                        }).toThrow(new Error('"custom" is not a registered controller.'));
-                       expect(Chart.defaults.custom).not.toBeDefined();
+                       expect(Chart.defaults.controllers.custom).not.toBeDefined();
                });
 
                it('as scale', function() {
@@ -285,11 +285,13 @@ describe('Chart.registry', function() {
        });
 
        it('should not register anything that would collide with existing defaults', function() {
+               Chart.defaults.controllers.test = {test: true};
                class testController extends Chart.DatasetController {}
-               testController.id = 'events';
+               testController.id = 'test';
                expect(function() {
                        Chart.register(testController);
-               }).toThrow(new Error('Can not register "events", because "defaults.events" would collide with existing defaults'));
+               }).toThrow(new Error('Can not register "test", because "defaults.controllers.test" would collide with existing defaults'));
+               delete Chart.defaults.controllers.test;
        });
 
        describe('should handle multiple items', function() {
index ccbbea180a504001513d6afc85fcd8dc5ca76b6c..b1a06946ee64d382db852c5d21ea0795168e381b 100644 (file)
@@ -33,7 +33,7 @@ describe('Default Configs', function() {
 
        describe('Doughnut Chart', function() {
                it('should return correct tooltip strings', function() {
-                       var config = Chart.defaults.doughnut;
+                       var config = Chart.defaults.controllers.doughnut;
                        var chart = window.acquireChart({
                                type: 'doughnut',
                                data: {
@@ -59,7 +59,7 @@ describe('Default Configs', function() {
                });
 
                it('should return correct tooltip string for a multiline label', function() {
-                       var config = Chart.defaults.doughnut;
+                       var config = Chart.defaults.controllers.doughnut;
                        var chart = window.acquireChart({
                                type: 'doughnut',
                                data: {
@@ -89,7 +89,7 @@ describe('Default Configs', function() {
                });
 
                it('should return correct legend label objects', function() {
-                       var config = Chart.defaults.doughnut;
+                       var config = Chart.defaults.controllers.doughnut;
                        var chart = window.acquireChart({
                                type: 'doughnut',
                                data: {
@@ -130,7 +130,7 @@ describe('Default Configs', function() {
                });
 
                it('should hide the correct arc when a legend item is clicked', function() {
-                       var config = Chart.defaults.doughnut;
+                       var config = Chart.defaults.controllers.doughnut;
                        var chart = window.acquireChart({
                                type: 'doughnut',
                                data: {
@@ -159,7 +159,7 @@ describe('Default Configs', function() {
 
        describe('Polar Area Chart', function() {
                it('should return correct tooltip strings', function() {
-                       var config = Chart.defaults.polarArea;
+                       var config = Chart.defaults.controllers.polarArea;
                        var chart = window.acquireChart({
                                type: 'polarArea',
                                data: {
@@ -185,7 +185,7 @@ describe('Default Configs', function() {
                });
 
                it('should return correct legend label objects', function() {
-                       var config = Chart.defaults.polarArea;
+                       var config = Chart.defaults.controllers.polarArea;
                        var chart = window.acquireChart({
                                type: 'polarArea',
                                data: {
@@ -226,7 +226,7 @@ describe('Default Configs', function() {
                });
 
                it('should hide the correct arc when a legend item is clicked', function() {
-                       var config = Chart.defaults.polarArea;
+                       var config = Chart.defaults.controllers.polarArea;
                        var chart = window.acquireChart({
                                type: 'polarArea',
                                data: {
index 2e6b78e4e6543c28120920164420e4bae70f022e..a9218c8953e0b2b786ef979efcffca3858ce33b5 100644 (file)
@@ -119,8 +119,8 @@ describe('Platform.dom', function() {
                });
 
                it('should use default "chart" aspect ratio for render and display sizes', function() {
-                       var ratio = Chart.defaults.doughnut.aspectRatio;
-                       Chart.defaults.doughnut.aspectRatio = 1;
+                       var ratio = Chart.defaults.controllers.doughnut.aspectRatio;
+                       Chart.defaults.controllers.doughnut.aspectRatio = 1;
 
                        var chart = acquireChart({
                                type: 'doughnut',
@@ -133,7 +133,7 @@ describe('Platform.dom', function() {
                                }
                        });
 
-                       Chart.defaults.doughnut.aspectRatio = ratio;
+                       Chart.defaults.controllers.doughnut.aspectRatio = ratio;
 
                        expect(chart).toBeChartOfSize({
                                dw: 425, dh: 425,