Skip to main content

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

The responsive option allows you to define rules that apply different chart configurations based on screen dimensions:

Responsive Rules

Define rules based on chart dimensions:

Responsive Interface

TypeScript interface from Responsive.ts:

Container-Based Responsiveness

Charts automatically reflow to fit their container:

Common Responsive Patterns

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

  1. Container First - Use percentage-based container sizes with reflow()
  2. Breakpoints - Define clear breakpoints (mobile, tablet, desktop)
  3. Simplify on Mobile - Hide legends, abbreviate labels, reduce data points
  4. Test Thoroughly - Test on actual devices, not just browser resize
  5. Performance - Limit the number of responsive rules
  6. Touch Friendly - Increase touch target sizes on mobile
Responsive rules are evaluated from first to last. If multiple rules match, the last matching rule’s options take precedence. Order your rules carefully.

Framework Integration

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