Overview
amCharts 5 is designed to handle large datasets and complex visualizations efficiently. However, when working with massive amounts of data or resource-constrained environments, performance optimization becomes crucial.Frame Rate Control
Setting Maximum FPS
Control the maximum frames per second (FPS) to balance smoothness with performance. By default, amCharts runs at the highest possible FPS.If
fps is set to undefined (default), the chart will run at the highest FPS possible, typically 60 FPS or higher depending on the browser and display.Safe Resolution Mode
TheuseSafeResolution setting helps prevent memory issues on platforms with strict memory limitations, such as Safari.
Data Optimization
Limiting Data Points
When working with large datasets, consider showing only a subset of data and using zoom/scroll to navigate.Aggregate Data Exclusion
Optimize performance by excluding fields from automatic aggregation when aggregate values aren’t needed.Visual Element Optimization
Hiding Elements Conditionally
Use theforceHidden property to completely hide elements and skip their rendering.
The difference between
forceHidden and visible is that forceHidden completely skips rendering, while visible: false still processes the element but doesn’t display it.Reducing Bullets
Bullets can significantly impact performance with large datasets. Consider reducing or removing them.Animation Performance
Disabling Animations
For charts with frequent updates or large datasets, consider disabling animations.Controlling Animation Duration
Memory Management
Proper Disposal
Always dispose of chart instances when they’re no longer needed to prevent memory leaks.Reusing Instances
Instead of creating and destroying chart instances frequently, consider updating existing instances.Rendering Optimization
Pausing Updates
When making multiple changes, pause the chart to batch updates.Auto-Resize Control
Control whether charts automatically resize when the container changes.Performance Best Practices
For Large Datasets (10,000+ points)
For Large Datasets (10,000+ points)
- Use data grouping and aggregation
- Implement virtual scrolling with scrollbars
- Reduce or eliminate bullets
- Disable tooltips or use pointer-based tooltips only
- Set a maximum FPS limit (30 FPS)
For Mobile Devices
For Mobile Devices
- Enable
useSafeResolution - Reduce animation durations
- Limit the number of series
- Use responsive theme to hide elements on small screens
- Set FPS to 30 or lower
For Real-Time Updates
For Real-Time Updates
- Batch data updates instead of updating individual points
- Use
interpolationDuration: 0for instant updates - Consider using a rolling window of data
- Limit the update frequency to what users can perceive (30-60 FPS)
For Multiple Charts
For Multiple Charts
- Share a single root instance when possible
- Stagger chart initialization
- Use lazy loading for off-screen charts
- Consider using a lower FPS limit
Profiling and Debugging
Measuring Performance
Use browser DevTools to profile your charts:Identifying Bottlenecks
- Check the number of DOM elements created
- Monitor memory usage over time
- Profile animation performance
- Measure data processing time
Related Resources
Responsive Design
Learn how to optimize charts for different screen sizes
Data Loading
Best practices for loading and managing data