[Chartjs]-Using vue-chartjs in vue 3 : createElement is not a function

6👍

https://github.com/apertureless/vue-chartjs

Vue Charts does not seem to be ready for vue3

Compatibility

v1 later @legacy
    Vue.js 1.x
v2 later
    Vue.js 2.x

Discussion about vue3 here: https://github.com/apertureless/vue-chartjs/issues/601
and here: https://github.com/apertureless/vue-chartjs/issues/637

14👍

Update 2022

The library supports vue 3 now and you can install as follows :

pnpm add vue-chartjs chart.js
# or
yarn add vue-chartjs chart.js
# or
npm i vue-chartjs chart.js

Old answer

According to this issue this library doesn’t support Vue 3 yet, and the origin of this error could explained here :

in vue 2 we do the following to create a render function :

export default {
  render(createElement ) { // createElement  could be written h
    return createElement('div')
  }
}

in Vue 3 :

import { h } from 'vue'

export default {
  render() {
    return h('div')
  }
}

which means that createElement is undefined

Leave a comment