Am using "react-chartjs-2" to show charts, and I would like to show a page "/element" when I click on one of my chart elements. So I am using this option :
const option = {
responsive: true,
maintainAspectRatio: false,
onClick (element) {
if (element && element[0]) {
console.log(element[0]._index);
history.push('/element');
}
}
}
So when I click on any element of the chart, It gives me the correct page, but few moment later it shows this error :
Uncaught TypeError: this.getDatasetMeta(...).controller is null
updateHoverStyle Chart.js:10143
handleEvent Chart.js:10241
eventHandler Chart.js:10167
listener Chart.js:10100
<anonymous> Chart.js:7830
addListener Chart.js:7535
addEventListener Chart.js:7833
bindEvents Chart.js:10104
each Chart.js:2231
bindEvents Chart.js:10103
initialize Chart.js:9388
construct Chart.js:9373
Chart Chart.js:9311
renderChart index.js:247
componentDidMount index.js:52
React 13
Redux 2
e (index):2494
Redux 2
onFulfilled middleware.js:23
promise callback*./src/config/middleware.js/promiseMiddleware/</< middleware.js:34
dispatch (index):3665
bindActionCreator Redux
componentWillMount Login.js:125
React 21
js index.js:43
Webpack 6
Chart.js:10143
I have no idea why I am getting this error. Any help please ?