-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
I used PieChart in a component. It works when it first rendered. But I got this error after any state update:
TypeError: undefined is not a function (near '...', click).transition().duration(750).att...')
logCapturedError — react-dom.development.js:16477
This is how I used the PieChart:
<PieChart
size={CHART_SIZE}
data={[
{ key: 'A', value: 100, color: CHART_RED },
{ key: 'B', value: 200, color: CHART_ORANGE },
{ key: 'C', value: 50, color: CHART_YELLOW },
{ key: 'D', value: 50, color: CHART_GREEN },
{ key: 'E', value: 50, color: CHART_BLUE },
]}/>
It works when I forked from the repo and comment out the some lines of codes (transition) like this:
if (n) { // we don't need to do this, but it's fun
/*
* Change current slices
* Transition current slice dimensions
*/
path
.attr('fill', getSliceFill)
.on('mouseover', mouseover)
.on('mouseout', mouseout)
.on('mousemove', mousemove)
.on('click', click)
// .transition()
// .duration(750)
// .attrTween('d', this.tweenSlice);
/*
* Add new slices
*/
path
.enter()
.append('path')
.attr('class', 'pie-chart-slice')
.attr('fill', getSliceFill)
.on('mouseover', mouseover)
.on('mouseout', mouseout)
.on('mousemove', mousemove)
.on('click', click)
.each((d, i) => currentSlices.splice(i, 1, d))
// .transition()
// .duration(750)
// .attrTween('d', this.tweenSlice);
}
Versions:
react-easy-chart: 1.0.0
react: ^16.6.0
react-dom: ^16.6.0
Metadata
Metadata
Assignees
Labels
No labels
