5👍
You can import the directive like this:
import * as pluginDataLabels from 'chartjs-plugin-datalabels';
You can use Plugins in your ChartOptions
like this:
chartOptions: ChartOptions = {
...
plugins: {
pluginDataLabels
}
Another way is to call it in your chart:
public barChartPlugins = [pluginDataLabels];
You can see it done here.
However, both ways declare it globally. The only way I could figure out not to see them in all charts is to not display them.
chartOptions: ChartOptions = {
...
plugins: {
datalabels: {
display: false
},
}
This also solves the Problem @NakulSharma has. You can see the plugin options here.
Source:stackexchange.com