score: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: stackoverflow.com
Related Query
- How to import Chart.js chartjs-plugin-datalabels npm package into an Angular 7 project
- How to properly use the chartjs datalabels plugin
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
- Unable to ES6 import ChartJS plugin into Aurelia
- how to insert dynamic data from sql into chartjs stacked bar chart javascript
- How do you get the width of a datalabel from the Chartjs plugin after the chart animates?
- How Can I Get An Instance of a ChartJS Bar Chart Using Angular
- How to inject data into chartjs plugin function?
- How to Import Angular Chart in IONIC
- chartjs : how to set custom scale in bar chart
- chartjs datalabels change font and color of text displaying inside pie chart
- How to fix chart Legends width-height with overflow scroll in ChartJS
- angular 5 chart.js datalabels plugin
- How to feed hour and minute data into chartJS
- How do I import a csv into chart.js?
- Datalabels plugin chartjs showing '[object]' instead of value
- How to draw Horizontal line on Bar Chart Chartjs
- Ng2-charts / chart.js - how to refresh/update chart - angular 4
- How do I import chartjs as an es6 module?
- How to update data Chart in async way in Angular Chart.js?
- How to dynamically set ChartJs line chart width based on dataset size?
- Angular 8 & ChartJs change color in pie chart
- How to set single color on each bar in angular chart js
- Chartjs - Insert additional data into chart tooltip
- Can't apply options of datalabels chartjs plugin in Vue
- How to add ChartJS code in Html2Pdf to view image
- ChartJS - how to display line chart with single element as a line? (not as a dot)
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- How to import and use a custom Chart.js plugin in Nuxt? (Chartjs-vuejs v2.9.4)
More Query from same tag
- ChartJS hover tooltip colors not showing their correct color
- What kind of graph could I use to achieve this with ChartJS (or similar)?
- Angular-chart / line chart with multiple horizontal lines (margins)
- Updating in chart.js
- ng2-charts update labels and data
- chartjs display data in one bar line with 3 different data sets in 3 different colors
- How show data label in the graph on Chart.js?
- ChartJS showing wrong dataset following visibility property toggle
- hh:mm in chart.js on X-axis and text labels on the Y-axis
- Smallest values are invisible in ng2-charts bar charts
- Chart JS Show HTML in Tooltip
- Chart.js 2.2.x - How to access the pixel coordinate of a point in my dataset
- How to set subscript text in Chart.js axis title
- Chart.js Fill line chart from another value than 0
- chart.js 2.0 current mouse coordinates tooltip
- Position of the x-axis labels is not in sync with the line chart data points
- Jquery Bargraph not Loading properly
- display data on chart.s
- Tooltip backgroundColor depending on chart color ChartJS
- Cross Browser Support for Chart.js
- when showing large amount of data graph not displaying from middle
- Chartjs - my old data show sometimes, bugs?
- How do I customize y-axis labels on a Chart.js line chart?
- use navigator clipboard to store image/png from canvas blob
- Chart.JS spacing and padding
- Plot time on Y axis
- return array from ajax
- ChartJS Bar chart with time scale - Bars overlap with each other
- javascript chart library for every minutes data
- Chart js 2.x renders the canvas invisible