File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ <h3>Most Frequent Airlines</h3>
8888 const flightRoutesData = { { site . data . flightRoutes | jsonify } } ;
8989</ script >
9090
91- < script src ="https://cdn.jsdelivr.net/npm/ chart.js "> </ script >
91+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.0/ chart.umd .js "> </ script >
9292< script src ="{{ '/js/flight-stats.js' | relative_url }} "> </ script >
9393
9494< style >
Original file line number Diff line number Diff line change @@ -309,7 +309,30 @@ class FlightStatsCalculator {
309309
310310// Initialize when DOM is loaded
311311document . addEventListener ( 'DOMContentLoaded' , function ( ) {
312+ console . log ( 'DOM loaded, checking for data...' ) ;
313+
312314 if ( typeof locationsData !== 'undefined' && typeof flightRoutesData !== 'undefined' ) {
313- new FlightStatsCalculator ( locationsData , flightRoutesData ) ;
315+ console . log ( 'Data found, initializing calculator...' ) ;
316+ console . log ( 'Locations:' , locationsData . length ) ;
317+ console . log ( 'Flights:' , flightRoutesData . length ) ;
318+
319+ try {
320+ new FlightStatsCalculator ( locationsData , flightRoutesData ) ;
321+ console . log ( 'FlightStatsCalculator initialized successfully' ) ;
322+ } catch ( error ) {
323+ console . error ( 'Error initializing FlightStatsCalculator:' , error ) ;
324+ }
325+ } else {
326+ console . error ( 'Required data is missing:' , {
327+ locationsData : typeof locationsData ,
328+ flightRoutesData : typeof flightRoutesData
329+ } ) ;
330+ }
331+
332+ // Check if Chart.js is loaded
333+ if ( typeof Chart === 'undefined' ) {
334+ console . error ( 'Chart.js is not loaded!' ) ;
335+ } else {
336+ console . log ( 'Chart.js is loaded successfully' ) ;
314337 }
315338} ) ;
You can’t perform that action at this time.
0 commit comments