Skip to content

Commit

Permalink
Options need to include dataset level defaults from main chart type (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg authored Feb 28, 2021
1 parent d08eb14 commit c040b82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/core.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions test/specs/core.controller.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit c040b82

Please sign in to comment.