-
src/lib/context/AppContext.tsx- Global animation settingsisAutoPlayEnabled: boolean- Master switch for all animationsautoPlaySpeed: number- Speed in milliseconds (default: 5000ms)toggleAutoPlay()- Function to toggle animation on/off
-
src/components/DataVisualization/index.tsx- Main visualization component- Passes
settings.isAutoPlayEnabledto child components - Contains debug info panel in development mode
- Passes
-
src/components/DataVisualization/AlluvialDiagram.tsx- Alluvial animation logic- Complex animation system with source highlighting
- Uses
useEffectwith multiple dependencies - Has visibility/focus handlers that can interrupt animation
-
src/components/DataVisualization/ChordDiagram.tsx- Chord animation logic- Simpler interval-based animation
- Cycles through different relationship modes
src/components/DataVisualization/shared/animationUtils.ts- Animation constantssrc/components/DataVisualization/shared/chordUtils.ts- Chord-specific animationssrc/components/DataVisualization/shared/d3Utils.ts- D3 animation helpers
src/app/admin/controls/page.tsx- Admin controls for animationsrc/components/DataVisualization/shared/EnhancedVisualizationHeader.tsx- Play/pause button
src/components/DataVisualization/shared/useVisualizationData.ts- Data loading hook- Animation won't start without data
- Falls back to mock data if real data fails
Open browser dev tools and look for these debug messages:
DataVisualization Component:
🎨 DataVisualization component settings: { isAutoPlayEnabled: true, autoPlaySpeed: 5000, ... }
Data Loading:
📊 useVisualizationData hook state: { dataLength: 3, isLoading: false, ... }
✅ Loaded real data: { totalResponses: 3, validResponses: 3, ... }
AlluvialDiagram Animation:
🎬 Animation useEffect triggered with conditions: { autoPlay: true, isAutoPlayEnabled: true, ... }
✅ Starting animation with settings: { autoPlaySpeed: 5000, sortedSources: [...], ... }
🚀 Animation initialized, calling animate()
🎭 Animate function called: { running: true, dataLength: 3, ... }
🎯 Animation highlighting source: { currentSourceIndex: 0, sourceName: "0-5", ... }
ChordDiagram Animation:
🎵 ChordDiagram animation useEffect: { autoPlay: true, isAutoPlayEnabled: true, ... }
✅ ChordDiagram starting animation cycle
🔄 ChordDiagram cycling to: { from: "tenure_years → learning_style", to: "..." }
Symptoms: ❌ Animation disabled: autoPlay= false isAutoPlayEnabled= false
Solution: Go to /admin/controls and enable "Auto Play Animations"
Symptoms: ❌ No data available for animation, data.length= 0
Solution: Check data loading. Should see mock data fallback if real data fails.
Symptoms: 🚫 Page hidden, cleaning up animation or 🚫 Page lost focus, cleaning up animation
Solution: Keep browser tab active and focused during testing
Symptoms: ❌ SVG ref not available
Solution: Component may be mounting before SVG is ready. Check render order.
Symptoms: ❌ Animation paused: isAnimating= false
Solution: Check if mouse hover or other interactions paused animation
-
Go to Admin Controls:
/admin/controls- Verify "Auto Play Animations" is ON
- Check animation speed (1000-10000ms)
- Use "Go to Visualization" button
-
Check Visualization Page:
/visualization- Look for debug panel in top-left (development mode)
- Check browser console for debug messages
- Try toggling play/pause button in header
-
Test Both Visualization Types:
- Alluvial diagram (default)
- Chord diagram (switch in header)
If animation still doesn't work, try these in browser console:
// Check current settings
console.log('Settings:', window.appSettings);
// Force animation restart (if component is available)
window.restartAnimation?.();
// Check if data is loaded
console.log('Data loaded:', window.visualizationData?.length);- Animation stops when browser tab loses focus - This is intentional for performance
- Animation doesn't start immediately - There's a delay for data loading
- Mouse hover pauses animation - This is intentional for user interaction
- Animation speed changes require page refresh - Settings update but timers don't restart
// In browser console
localStorage.clear();
location.reload();// In browser console (if useAppContext is available)
const { toggleAutoPlay } = useAppContext();
toggleAutoPlay();// In browser console
fetch('/api/survey').then(r => r.json()).then(console.log);In development mode, a debug panel appears in the top-left corner showing:
- AutoPlay: ON/OFF
- Speed: 5000ms
- Type: alluvial/chord
- Size: 1728x972
- Header Play/Pause Button: Toggles animation on/off
- Admin Controls: Global settings for all animations
- Mouse Hover: Temporarily pauses animation
- Page Focus: Animation stops when page loses focus
- Animation requires data to be loaded (real or mock)
- AlluvialDiagram has more complex animation than ChordDiagram
- Visibility/focus handlers can interrupt animation
- Animation speed is configurable from 1-10 seconds
- Debug messages only appear in development mode