bbonnin / vue-morris

VueJS component wrapping Morris.js
MIT License
237 stars 36 forks source link

[Vue warn]: Error in nextTick: "TypeError: Cannot read property 'clear' of undefined" #6

Closed Julian367 closed 6 years ago

Julian367 commented 6 years ago

Hello, As title say I get this error and donut chart is not show

bbonnin commented 6 years ago

Hello, Could you provide more information about your context ? Version, code snippets, ... Thanks !

Julian367 commented 6 years ago

Hello, Thank you for your fast replay. I'm using latest version 0.0.9. Here is my code

<template>
    <div>
        <donut-chart
                id="donut"
                :data="donutData"
                colors='[ "#1ab394", "#ff000a", "#867389"]'
                resize="true">
        </donut-chart>
    </div>
</template>

<script>
    import Raphael from 'raphael/raphael'
    global.Raphael = Raphael
    import {DonutChart} from 'vue-morris'
    export default {
        props: ["profileUserId"],
        components: {
            DonutChart,
        },
        data() {
            return {
                donutData: []
            }
        },
        mounted () {
            this.fetchAllUserStatistics()
        },
        methods: {
            fetchAllUserStatistics() {
                let vm = this
                axios.get('/api/user-statistics/' + this.profileUserId).then(
                    function (response) {
                        vm.donutData = response.data.chartData
                    }
                )
            }
        },
    }
</script>

chartData looks like this

[
{
"label": "Test1",
"value": 73
},
{
"label": "Test2",
"value": 71
},
{
"label": "Test3",
"value": 28
}
]
bbonnin commented 6 years ago

Thanks for reporting this bug.

bbonnin commented 6 years ago

Fix v0.0.10