vue-charts
vue-charts copied to clipboard
Cannot read property 'beginAtZero' of undefined
Hello!
After update to 1.2.8 I got this error:
[Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'beginAtZero' of undefined"
It's occurred only on Pie chart, Doughnut chart, and Radar chart. After some investigations, I found that if I rewrite options like `v-bind:option="someOption" these charts start to work normally as expected.
I guess could the problem be in the code, where you set option by default as null:
option: {
type: Object,
default: () => null,
},
So if the option: null
, therefore 'beginAtZero' is a property of undefined.
@moonlik do you have a demo of how you got it working? I tried
But is still didn't work.
@craigharman I just added v-bind:option="myoption"
to the chartjs-pie
component and in the script specify myoption
in the data like this:
<template>
...
<chartjs-pie
v-bind:labels="deviceLabels"
v-bind:data="deviceData"
v-bind:backgroundcolor="deviceBackgroundColor"
v-bind:hoverbackgroundcolor="deviceHoverBackgroundColor"
v-bind:bind="true"
v-bind:option="myoption">
</chartjs-pie>
...
</template>
<script>
export default {
data () {
return {
myoption: {},
...
</script>
@craigharman I also have noticed that after npm update
the package doesn't work, so it's better to reinstall it
1.2.8... happens here too.
Same here. Can't use pie chart.
I ended up just using chart.js itself, no wrapper. Works fine & is easy.