mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix for chart title not updating
https://github.com/chartjs/Chart.js/issues/2686 Chart options were using a cache value from initialize function. Now updating values in the beforeUpdate lifecycle.
This commit is contained in:
parent
829c2be2bc
commit
54d1e49bb7
@ -29,10 +29,15 @@ module.exports = function(Chart) {
|
||||
|
||||
// These methods are ordered by lifecyle. Utilities then follow.
|
||||
|
||||
beforeUpdate: noop,
|
||||
beforeUpdate: function () {
|
||||
var chartOpts = this.chart.options;
|
||||
if (chartOpts && chartOpts.title) {
|
||||
this.options = helpers.configMerge(Chart.defaults.global.title, chartOpts.title);
|
||||
}
|
||||
},
|
||||
update: function(maxWidth, maxHeight, margins) {
|
||||
|
||||
// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
|
||||
// Update Lifecycle
|
||||
this.beforeUpdate();
|
||||
|
||||
// Absorb the master measurements
|
||||
@ -195,4 +200,4 @@ module.exports = function(Chart) {
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user