Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call determineDataLimits only once #6256

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core/core.layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ module.exports = {

// Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends
// on the margin. Sometimes they need to increase in size slightly
box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin);
box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin, true);
} else {
box.update(minBoxSize.width, maxChartAreaHeight);
box.update(minBoxSize.width, maxChartAreaHeight, undefined, true);
}
}
}
Expand All @@ -303,7 +303,7 @@ module.exports = {
};

if (minBoxSize) {
box.update(minBoxSize.width, maxChartAreaHeight, scaleMargin);
box.update(minBoxSize.width, maxChartAreaHeight, scaleMargin, true);
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,9 @@ module.exports = Element.extend({
helpers.callback(this.options.beforeUpdate, [this]);
},

update: function(maxWidth, maxHeight, margins) {
update: function(maxWidth, maxHeight, margins /** @private subsequentCall */) {
var me = this;
var subsequentCall = arguments[3];
var i, ilen, labels, label, ticks, tick;

// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
Expand All @@ -259,9 +260,11 @@ module.exports = Element.extend({
me.afterSetDimensions();

// Data min/max
me.beforeDataLimits();
me.determineDataLimits();
me.afterDataLimits();
if (!subsequentCall) {
me.beforeDataLimits();
me.determineDataLimits();
me.afterDataLimits();
}

// Ticks - `this.ticks` is now DEPRECATED!
// Internal ticks are now stored as objects in the PRIVATE `this._ticks` member
Expand Down Expand Up @@ -320,7 +323,6 @@ module.exports = Element.extend({
me.afterUpdate();

return me.minSize;

},
afterUpdate: function() {
helpers.callback(this.options.afterUpdate, [this]);
Expand Down