Skip to content

onEvents: 'click' appears to disable animations/transitions for barchart #536

@arkim822

Description

@arkim822

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions