- Notifications
You must be signed in to change notification settings - Fork 655
Closed
Description
After adding onEvents = {{'click' : somefunction }} I am unable to set animations and/or transitions for my barchart whenever the data changes. Has anyone else ran into this issue?
I have removed a lot of the parameters to make the code a bit more readable in case it would help to see.
import React from 'react' import ReactECharts from 'echarts-for-react'; import { useEffect, useState, useCallback } from 'react'; export default function BarChartPlot(props) { const [chartdata, setChartData] = useState([]); useEffect(() =>{ setGraphData(props.graphdata) }, [props.graphdata]); const options = { title: [ {text: 'A BarChart'} ], animation: true, xAxis: { }, yAxis: [ { type: 'category', nameLocation: 'middle', nameGap: 30, inverse: true, max : 9 }, ], series: [{name: "Some series", type: 'bar', color: '#76BE58', label: { show: true, position: 'right' }, data: chartdata}, ] }; const triggerOnClick = useCallback((params) => { var childData = params.data[1]; props.onClickFromChildTech(childData); }, [props.onClickFromChildTech]); return ( <div> <ReactECharts onEvents={{'click': triggerOnClick}} option={options} lazyUpdate = {false} notMerge={true} style={{width: '700px', height: '400px' }} /> </div> ) } Metadata
Metadata
Assignees
Labels
No labels