emn178 / chartjs-plugin-labels

Plugin for Chart.js to display percentage, value or label in Pie or Doughnut.
MIT License
614 stars 219 forks source link

How to add this plugin to Vue project? #124

Open scorpioRED opened 4 years ago

scorpioRED commented 4 years ago

Hi! I didn't find any instruction about how to add this plugin to Vue project if I already use chartjs

sumant4ssm commented 4 years ago

Hi! I didn't find any instruction about how to add this plugin to Vue project if I already use chartjs

I too want to use this with Vue js but it doesn't seem to be working, may we are not properly configuring it?

almunnings commented 3 years ago

Using vue-chartjs it works with the following example:

import { Doughnut } from 'vue-chartjs';
import ChartPluginLabels from 'chartjs-plugin-labels';

export default {
  name: 'ChartDoughnut',

  extends: Doughnut,

  props: {
    chartData: {
      type: Object,
      default: () => {},
    },
    options: {
      type: Object,
      default: () => {},
    },
    plugins: {
      type: Array,
      default: () => [ChartPluginLabels],
    },
  },

  mounted() {
    this.renderChart(this.chartData, this.options);
  },
};