vue-chart-3: Getting VueCompositionApi error

Version: 0.4.10 or 0.5.0-alpha.2

image

[Vue warn]: Error in data(): "Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function."

found in

---> <BarChart>
       <VCard>

In my main.ts I definitely have a Vue.use(VueCompositionAPI); call and everything else is working. But the charts are not rendered

Example code for a chart:

v-card(:min-height="200", height="100%")
  v-card-title URL Types
    v-card-text
      bar-chart(:chart-data="typesData", :options="typesOptions", :height="50")


typesData = { datasets: [...], labels: [...] }

typesOptions = {
  plugins: {
    legend: { display: false }
  },
  scales: {
    x: {
      beginAtZero: true
    }
  },
  indexAxis: 'y'
}

I’m trying to migrate from vue-chartjs to your plugin cause you support chartjs v3 (https://github.com/apertureless/vue-chartjs/issues/695#issuecomment-863962827)

I also have created a src/plugins/chart.ts that is imported via import './plugins/chart.ts' in my main.ts

import { ArcElement, BarController, Chart, PieController, Tooltip } from 'chart.js';

Chart.register(BarController, PieController, ArcElement, Tooltip);

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Got the same error here since a few days, gonna try pinning versions of vue-demi or vue-chart-3 to lower versions

Also the build passed now :p