-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'clearRect' of null #12
Comments
I had the same probem with a component that renders charts when the user clicks on a specific place. Something like: <template>
<chart-here
v-if="currentChartData !== null"
@close="currentChartData = null"
:chart-data="currentChartData"
/>
<div v-else>
Rest of code...
</div>
</template> If you click on close before the animations are done, it throws the same <template>
<chart-here
v-if="currentChartData !== null"
@close="closeCharts"
:chart-data="currentChartData"
/>
<div v-else>
Rest of code...
</div>
</template>
<script>
export default {
// ...
methods: {
closeCharts() {
for (const chart of Object.values(window.Chart.instances)) {
window.Chart.animationService.cancelAnimation(chart);
}
this.currentChartData = null;
},
},
// ...
}
</script> This will cancel animations for all charts though. Maybe the components provided by this library that we |
Getting this issue too, if a user presses back on browser and forward again quickly chart fails to render, or if you mutate the chart data quickly |
anyone of you who had a solution for this issue now, please post here. @elie464 @tuannguyenminh2086 @antoniosarosi |
Hey @ahmedrazaa i just wrote my own wrapper components on chart.js library and called |
Any news on this issue? I'm facing the same problem even with the the cancelAnimation trick |
Hi @vutran6853 ,
Thanks for your awesome plugin. But when I integrate it with my code. and it get issues when update data:
Chart.js:2743 Uncaught TypeError: Cannot read property 'clearRect' of null at Object.clear (Chart.js:2743) at Chart.clear (Chart.js:9403) at Chart.draw (Chart.js:9820) at Chart.render (Chart.js:9798) at Object.callback (Chart.js:2207) at Object.advance (Chart.js:3543) at Object.startDigest (Chart.js:3516) at eval (Chart.js:3505)
Is there any support?
The text was updated successfully, but these errors were encountered: