From c040b8255e40d07550caa6c77c12f0e772280c33 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Sun, 28 Feb 2021 01:58:07 -0500 Subject: [PATCH] Options need to include dataset level defaults from main chart type (#8534) --- src/core/core.config.js | 4 +++- test/specs/core.controller.tests.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/core.config.js b/src/core/core.config.js index f93a8ba9e..32b70dded 100644 --- a/src/core/core.config.js +++ b/src/core/core.config.js @@ -276,9 +276,11 @@ export default class Config { * @return {object[]} */ chartOptionScopes() { + const controllerDefaults = defaults.controllers[this.type] || {}; return [ this.options, - defaults.controllers[this.type] || {}, + controllerDefaults, + controllerDefaults.datasets || {}, {type: this.type}, defaults, defaults.descriptors diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index e618e9c1f..2fb13eb4b 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -171,6 +171,17 @@ describe('Chart', function() { defaults.controllers.line.spanGaps = false; }); + it('should initialize config with default dataset options', function() { + var defaults = Chart.defaults.controllers.pie.datasets; + + var chart = acquireChart({ + type: 'pie' + }); + + var options = chart.options; + expect(options.circumference).toBe(defaults.circumference); + }); + it('should override axis positions that are incorrect', function() { var chart = acquireChart({ type: 'line',