Options need to include dataset level defaults from main chart type (#8534)

This commit is contained in:
Evert Timberg 2021-02-28 01:58:07 -05:00 committed by GitHub
parent d08eb147fc
commit c040b8255e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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',