File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,7 +134,10 @@ async function populate30DayGraph(scope, id){
134134 monthHoursGraph = createChart ( ) ;
135135}
136136
137+ let resizeTimer ;
138+
137139window . addEventListener ( 'resize' , ( ) => {
140+ clearTimeout ( resizeTimer ) ;
138141 // Destroy the existing chart instances for all canvases
139142 if ( weekCompareGraph ) {
140143 weekCompareGraph . destroy ( ) ;
@@ -145,9 +148,10 @@ window.addEventListener('resize', () => {
145148 if ( monthHoursGraph ) {
146149 monthHoursGraph . destroy ( ) ;
147150 }
148-
149- // Recreate the chart instances for all canvases with updated dimensions
150- weekCompareGraph = createWeekCompare ( ) ;
151- annualHoursGraph = createAnnualHoursGraph ( ) ;
152- monthHoursGraph = createChart ( ) ;
151+
152+ resizeTimer = setTimeout ( ( ) => {
153+ weekCompareGraph = createWeekCompare ( ) ;
154+ annualHoursGraph = createAnnualHoursGraph ( ) ;
155+ monthHoursGraph = createChart ( ) ;
156+ } , 500 ) ;
153157} ) ;
You can’t perform that action at this time.
0 commit comments