Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,13 @@ helpers.extend(Chart.prototype, /** @lends Chart */ {
plugins.notify(me, 'resize', [newSize]);

// Notify of resize
if (me.options.onResize) {
me.options.onResize(me, newSize);
if (options.onResize) {
options.onResize(me, newSize);
}

me.stop();
me.update({
duration: me.options.responsiveAnimationDuration
duration: options.responsiveAnimationDuration
});
}
},
Expand Down
9 changes: 8 additions & 1 deletion src/platforms/platform.dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,14 @@ function addResizeListener(node, listener, chart) {
// Let's keep track of this added resizer and thus avoid DOM query when removing it.
var resizer = expando.resizer = createResizer(throttled(function() {
if (expando.resizer) {
return listener(createEvent('resize', chart));
var container = chart.options.maintainAspectRatio && node.parentNode;
var w = container ? container.clientWidth : 0;
listener(createEvent('resize', chart));
if (container && container.clientWidth !== w && chart.canvas) {
// If the container size changed during chart resize, we can assume scrollbar appeared.
// So let's resize again, with the scrollbar visible
listener(createEvent('resize', chart));
}
}
}));

Expand Down