Responsive Charts
Responsive design is essential for modern web applications. Highcharts provides powerful responsive features that automatically adapt charts to different screen sizes and orientations.Responsive Options
Theresponsive option allows you to define rules that apply different chart configurations based on screen dimensions:
Responsive Rules
- Basic Rules
- Callback Functions
- Multiple Conditions
Define rules based on chart dimensions:
Responsive Interface
TypeScript interface fromResponsive.ts:
Container-Based Responsiveness
Charts automatically reflow to fit their container:Common Responsive Patterns
- Mobile Optimized
- Tablet & Desktop
- Orientation Change
Real-World Example
Complete responsive chart from the source samples:Chart Methods
chart.reflow()
Reflow the chart to fit container
chart.setSize()
Set explicit chart dimensions
chart.setResponsive()
Re-evaluate responsive rules
chart.update()
Update responsive options
CSS Integration
Combine responsive options with CSS:Performance Optimization
Avoid setting too many responsive rules or using complex callback functions, as they can impact performance during window resize events.
Responsive Options Reference
Array<RuleOptions>
Array of responsive rules. Each rule contains a condition and chart options to apply.
number
The responsive rule applies when the chart width is less than or equal to this value.
number
The responsive rule applies when the chart width is greater than or equal to this value.
number
The responsive rule applies when the chart height is less than or equal to this value.
number
The responsive rule applies when the chart height is greater than or equal to this value.
function
A callback function to determine if the rule should be applied. Return
true to apply the rule.Partial<Options>
Chart options to apply when the condition is met. These options are merged with the current chart options.
Best Practices
- Container First - Use percentage-based container sizes with
reflow() - Breakpoints - Define clear breakpoints (mobile, tablet, desktop)
- Simplify on Mobile - Hide legends, abbreviate labels, reduce data points
- Test Thoroughly - Test on actual devices, not just browser resize
- Performance - Limit the number of responsive rules
- Touch Friendly - Increase touch target sizes on mobile
Framework Integration
- React
- Vue
- Angular
Next Steps
Chart Configuration
Learn about chart structure and options
Options
Explore global configuration options
Examples
See responsive chart examples
API Reference
Complete responsive API documentation