Skip to content

Zoom and Scroll

Yeray edited this page Mar 22, 2018 · 2 revisions

Charts can be zoomed and scrolled by manual code or mouse / touch events.

Default behaviour is to drag the right mouse button inside axes to scroll, and drag a rectangle using the left mouse button to zoom / unzoom (zoom dragging to bottom-right direction, and unzoom dragging to left-top direction).

This can be overridden using the chart zoom and scroll properties:

Chart1.zoom.enabled = true;
Chart1.zoom.mouseButton = 0;    // 0=left button, 1=middle, 2=right button
Chart1.zoom.stroke.fill = “yellow”;
Chart1.scroll.enabled = true;
Chart1.scroll.mouseButton = 2;
Chart1.scroll.direction = “horizontal”;   // can be: “vertical” or “both”

The chart onzoom event is triggered when the user releases the mouse button after the chart is zoomed.

The chart onscroll event is triggered while the user is scrolling the chart by dragging it.

Clone this wiki locally