Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Cannot read property 'beginAtZero' of undefined #33

Open
moonlik opened this issue Sep 22, 2017 · 6 comments
Open

Cannot read property 'beginAtZero' of undefined #33

moonlik opened this issue Sep 22, 2017 · 6 comments

Comments

@moonlik
Copy link

moonlik commented Sep 22, 2017

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.

@craigharman
Copy link

@moonlik do you have a demo of how you got it working? I tried

But is still didn't work.

@moonlik
Copy link
Author

moonlik commented Sep 25, 2017

@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>

@moonlik
Copy link
Author

moonlik commented Oct 17, 2017

@craigharman I also have noticed that after npm update the package doesn't work, so it's better to reinstall it

@mikerogne
Copy link

1.2.8... happens here too.

@albertleao
Copy link

Same here. Can't use pie chart.

@mikerogne
Copy link

I ended up just using chart.js itself, no wrapper. Works fine & is easy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants