File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -88,9 +88,19 @@ export class HaChartBase extends LitElement {
8888
8989 private _lastTapTime ?: number ;
9090
91+ private _shouldResizeChart = false ;
92+
9193 // @ts -ignore
9294 private _resizeController = new ResizeController ( this , {
93- callback : ( ) => this . chart ?. resize ( ) ,
95+ callback : ( ) => {
96+ if ( this . chart ) {
97+ if ( ! this . chart . getZr ( ) . animation . isFinished ( ) ) {
98+ this . _shouldResizeChart = true ;
99+ } else {
100+ this . chart . resize ( ) ;
101+ }
102+ }
103+ } ,
94104 } ) ;
95105
96106 private _loading = false ;
@@ -366,6 +376,7 @@ export class HaChartBase extends LitElement {
366376 if ( ! this . options ?. dataZoom ) {
367377 this . chart . getZr ( ) . on ( "dblclick" , this . _handleClickZoom ) ;
368378 }
379+ this . chart . on ( "finished" , this . _handleChartRenderFinished ) ;
369380 if ( this . _isTouchDevice ) {
370381 this . chart . getZr ( ) . on ( "click" , ( e : ECElementEvent ) => {
371382 if ( ! e . zrByTouch ) {
@@ -945,6 +956,13 @@ export class HaChartBase extends LitElement {
945956 } ) ;
946957 }
947958
959+ private _handleChartRenderFinished = ( ) => {
960+ if ( this . _shouldResizeChart ) {
961+ this . chart ?. resize ( ) ;
962+ this . _shouldResizeChart = false ;
963+ }
964+ } ;
965+
948966 static styles = css `
949967 : host {
950968 dis play: block;
You can’t perform that action at this time.
0 commit comments