diff --git a/src/controllers/controller.doughnut.js b/src/controllers/controller.doughnut.js index 2ec30ee35..ba21c4506 100644 --- a/src/controllers/controller.doughnut.js +++ b/src/controllers/controller.doughnut.js @@ -217,11 +217,7 @@ module.exports = function(Chart) { innerRadius = reset && animationOpts.animateScale ? 0 : this.innerRadius, outerRadius = reset && animationOpts.animateScale ? 0 : this.outerRadius, custom = arc.custom, - valueAtIndexOrDefault = helpers.getValueAtIndexOrDefault, - backgroundColor = "backgroundColor", - hoverBackgroundColor = "hoverBackgroundColor", - borderWidth = "borderWidth", - borderColor = "borderColor"; + valueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; helpers.extend(arc, { // Utility @@ -243,10 +239,10 @@ module.exports = function(Chart) { }); var model = arc._model; - model[backgroundColor] = custom && custom[backgroundColor] ? custom[backgroundColor] : valueAtIndexOrDefault(dataset[backgroundColor], index, arcOpts[backgroundColor]); - model[hoverBackgroundColor] = custom && custom[hoverBackgroundColor] ? custom[hoverBackgroundColor] : valueAtIndexOrDefault(dataset[hoverBackgroundColor], index, arcOpts[hoverBackgroundColor]); - model[borderWidth] = custom && custom[borderWidth] ? custom[borderWidth] : valueAtIndexOrDefault(dataset[borderWidth], index, arcOpts[borderWidth]); - model[borderColor] = custom && custom[borderColor] ? custom[borderColor] : valueAtIndexOrDefault(dataset[borderColor], index, arcOpts[borderColor]); + model.backgroundColor = custom && custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(dataset.backgroundColor, index, arcOpts.backgroundColor); + model.hoverBackgroundColor = custom && custom.hoverBackgroundColor ? custom.hoverBackgroundColor : valueAtIndexOrDefault(dataset.hoverBackgroundColor, index, arcOpts.hoverBackgroundColor); + model.borderWidth = custom && custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(dataset.borderWidth, index, arcOpts.borderWidth); + model.borderColor = custom && custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(dataset.borderColor, index, arcOpts.borderColor); // Set correct angles if not resetting if (!reset || !animationOpts.animateRotate) { diff --git a/src/core/core.title.js b/src/core/core.title.js index 0982986ca..b6d82c07e 100644 --- a/src/core/core.title.js +++ b/src/core/core.title.js @@ -111,20 +111,18 @@ module.exports = function(Chart) { globalDefaults = Chart.defaults.global, display = opts.display, fontSize = valueOrDefault(opts.fontSize, globalDefaults.defaultFontSize), - minSize = _this.minSize, - width = "width", - height = "height"; + minSize = _this.minSize; if (_this.isHorizontal()) { - minSize[width] = _this.maxWidth; // fill all the width - minSize[height] = display ? fontSize + (opts.padding * 2) : 0; + minSize.width = _this.maxWidth; // fill all the width + minSize.height = display ? fontSize + (opts.padding * 2) : 0; } else { - minSize[width] = display ? fontSize + (opts.padding * 2) : 0; - minSize[height] = _this.maxHeight; // fill all the height + minSize.width = display ? fontSize + (opts.padding * 2) : 0; + minSize.height = _this.maxHeight; // fill all the height } - _this[width] = minSize[width]; - _this[height] = minSize[height]; + _this.width = minSize.width; + _this.height = minSize.height; }, afterFit: noop,