Skip to content

Responsive

Charts auto-resize by default — responsive: true is the default. SwiftChart attaches a ResizeObserver to the container and re-renders on size changes.

new LineChart('#chart', { responsive: true }); // default
new LineChart('#chart', { responsive: false }); // pin to initial size

When responsive is off, you can still trigger a resize manually:

chart.resize();

In React, call ref.current?.resize() — see React refs.

The chart respects devicePixelRatio automatically, so output stays crisp on Retina displays.