Zoom
Any chart
ts
const chart = createChart(host, spec, { zoom: true });| Gesture | Does |
|---|---|
| Buttons | closer, further, back |
| Ctrl or ⌘ and wheel, two fingers | closer, around the pointer |
| Drag | moves, once closer |
| Double click | back |
The plain wheel keeps scrolling the page. Buttons work with the keyboard. Useful for network, sankey, flowchart, er, mindmap, timeline, tree, bracket, and any dense drawing. In an export, the part on screen is saved.
Lines, bars and prices
ts
createChart(host, { type: 'xy', zoom: true, … }); // drag to look closer, double click to come back
createChart(host, { type: 'candlestick', zoom: true, … }); // moving averages remember the prices before
chart.zoom(10, 25); // categories 10 to 25
chart.resetZoom();Axes are drawn again for the part shown, which a plain enlargement cannot do.
Maps
zoom: true in the spec of a map: buttons, drag, ctrl and wheel; a globe turns.
In the component
tsx
<Chart spec={spec} zoom style={{ height: 400 }} />html
<nervure-chart zoom spec="…"></nervure-chart>