-
Notifications
You must be signed in to change notification settings - Fork 13
-
Hello folks,
Could someone provide insight on how to utilize plot events provided in G2 Plot when using g2plot-react library?
I've designed a bar chart & I would like to perform some action when user clicks a particular element (i.e. bar) in the chart.
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
Answered by
kagawagao
Jul 15, 2021
Replies: 1 comment
-
you can use chartRef to access chart plot instance, then follow g2plot events api to bind event
const lineChartRef = useRef<Line>(); useEffect(() => { if (lineChartRef.current) { const plot = lineChartRef.current; plot.on("line:click", (e) => { console.log(e); }); } }, []);
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
0 replies
Answer selected by
kagawagao
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment