@@ -474,15 +474,17 @@ class Chart {
474474 me . notifyPlugins ( 'beforeElementsUpdate' ) ;
475475
476476 // Make sure all dataset controllers have correct meta data counts
477+ let minPadding = 0 ;
477478 for ( let i = 0 , ilen = me . data . datasets . length ; i < ilen ; i ++ ) {
478479 const { controller} = me . getDatasetMeta ( i ) ;
479480 const reset = ! animsDisabled && newControllers . indexOf ( controller ) === - 1 ;
480481 // New controllers will be reset after the layout pass, so we only want to modify
481482 // elements added to new datasets
482483 controller . buildOrUpdateElements ( reset ) ;
484+ minPadding = Math . max ( + controller . getMaxOverflow ( ) , minPadding ) ;
483485 }
484-
485- me . _updateLayout ( ) ;
486+ me . _minPadding = minPadding ;
487+ me . _updateLayout ( minPadding ) ;
486488
487489 // Only reset the controllers if we have animations
488490 if ( ! animsDisabled ) {
@@ -513,14 +515,14 @@ class Chart {
513515 * hook, in which case, plugins will not be called on `afterLayout`.
514516 * @private
515517 */
516- _updateLayout ( ) {
518+ _updateLayout ( minPadding ) {
517519 const me = this ;
518520
519521 if ( me . notifyPlugins ( 'beforeLayout' , { cancelable : true } ) === false ) {
520522 return ;
521523 }
522524
523- layouts . update ( me , me . width , me . height ) ;
525+ layouts . update ( me , me . width , me . height , minPadding ) ;
524526
525527 const area = me . chartArea ;
526528 const noArea = area . width <= 0 || area . height <= 0 ;
@@ -1087,7 +1089,7 @@ class Chart {
10871089 callCallback ( options . onHover || hoverOptions . onHover , [ e , active , me ] , me ) ;
10881090
10891091 if ( e . type === 'mouseup' || e . type === 'click' || e . type === 'contextmenu' ) {
1090- if ( _isPointInArea ( e , me . chartArea ) ) {
1092+ if ( _isPointInArea ( e , me . chartArea , me . _minPadding ) ) {
10911093 callCallback ( options . onClick , [ e , active , me ] , me ) ;
10921094 }
10931095 }
0 commit comments