scroll-chart
Description
Fires when a chart is scrolledUsage
"scroll-chart": ({
left?: number,
top?: number
}) => boolean | void;
Parameters
The callback of the scroll-chart action can take an object with the following parameters:
left
- (optional) specifies the number of pixels the chart is scrolled to the lefttop
- (optional) specifies the number of pixels the chart is scrolled to the top
info
For handling the actions you can use the Event Bus methods
Example
import { useEffect, useRef } from "react";
import { getData } from "./common/data";
import { Gantt } from "wx-react-gantt";
const GanttComponent = () => {
const data = getData();
const apiRef = useRef();
useEffect(() => {
if (apiRef.current) {
apiRef.current.on("scroll-chart", ev => {
console.log("The chart is scrolled");
});
}
}, [apiRef.current]);
return (
<Gantt
apiRef={apiRef}
tasks={data.tasks}
//other settings />
);
};
export default GanttComponent;
Related articles: How to access Gantt API