Removed $(document).ready() wrapper inside google.load callback which
was preventing charts from rendering when page loaded via Turbolinks.
Changes:
- Remove document.ready wrapper (DOM already ready with Turbolinks)
- Add check for element existence before drawing chart
- Add guard to verify google.load exists before calling
- Create separate initializeChart function for cleaner callback
This ensures charts render properly on Turbolinks page loads where
the DOM is already ready when the script executes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed "Cannot read properties of undefined (reading 'arrayToDataTable')"
error caused by calling Google Charts API before it finished loading.
Changes:
- Move google.load() call below function definitions
- Use callback parameter to ensure charts load after library is ready
- Add guard check in drawChart2() to verify google.visualization exists
- Wrap chart drawing in $(document).ready() within the callback
This ensures the visualization library is fully loaded before attempting
to create charts, preventing race condition errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>