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

Can't disable for specific charts #139

Open BrotherZach opened 3 years ago

BrotherZach commented 3 years ago

I'm using this to show percentages on some doughnut charts. The problem I'm running into is that I also have some bar charts on the same page that are also showing percentages and I don't want them to. I've tried to disable the plug in for these charts as it says in the chartjs documentation but it doesn't seem to be working. What is the recommended way to disable this on specific charts?

BrettBurbidge commented 3 years ago

I have a very similar issue. The ability to disable on some charts and also the ability to change the type from one chart to another. Here is an example:

When I set the Options.plugins.labels on one specific chart object it will set it for all chart objects.

When setting the labels to 'value' on customersThisWeek it will also set the labels to 'value' on customersThisMonth. I want to display the chart labels as 'values' on one chart and 'label' on another.

Help Setting this will set the labels as 'value' for all charts on the page. $scope.customersThisWeek.Options.plugins = { labels: { render: 'value' } }

Setting the labels as 'label', as below, has no affect. The customerThisMonth chart will also show as 'value'. $scope.customersThisMonth.Options.plugins = { labels: { render: 'label' } }

robel93 commented 3 years ago

Having same probnlem. Did you ever solve this issue?

BrotherZach commented 3 years ago

I have not. Unfortunately, this has made this plug-in unusable for me.

DoubleE1 commented 2 years ago

I just simply disable the labels for the specific chart by setting the options.labels to false. Hope this would help.

options: {
  labels: false
}
beaver71 commented 2 years ago

Please refer to https://www.chartjs.org/docs/latest/developers/plugins.html#disable-plugins

plugins: {
  labels: false
}

Originally posted by @emn178 in https://github.com/emn178/chartjs-plugin-labels/issues/76#issuecomment-434337977