zoom-scale
Description
Fires when zooming a chartUsage
"zoom-scale": ({
dir: number;
date: Date;
offset?: number;
}) => boolean | void;
Parameters
The callback of the zoom-scale action can take an object with the following parameters:
dir
- (required) direction of zooming: 1 (zoom in) or -1 (zoom out)date
- (required) the date applied as the center of the zoomed area. The date format should be of the one supported by date-fnsoffset
- (optional) the cursor location in the x-axis on a page in pixels
info
For handling the actions you can use the Event Bus methods
Example
<script>
import { getData } from "./common/data";
import { Gantt } from "wx-svelte-gantt";
const data = getData();
function init(api) {
api.on("zoom-scale", ev => {
console.log("The chart was zoomed");
});
}
</script>
<Gantt
tasks={data.tasks}
{init} />
Related articles: How to access Gantt API