Cory R
Cory R

Reputation: 145

I want to add label on only specific vue chart

enter image description here

I added the labels on vue pie chart using vue-chartjs and chartjs-plugin-labels module. But they are displayed on all charts. I want to display the labels on only specific chart. How can I do it?

Upvotes: 0

Views: 710

Answers (1)

LeeLenalee
LeeLenalee

Reputation: 31439

If you dont register it globally but only locally in the plugins array it will only activate for that chart

Example (only the first chart will have labels):

var chart = {
  type: 'pie',
  plugins: [chartjsPluginDatalabels],
  data: {},
  options: {}

var chart2 = {
  type: 'pie',
  plugins: [],
  data: {},
  options: {}

Codepen live example: https://codepen.io/leelenaleee/pen/yLgmmyd

Upvotes: 1

Related Questions