I'm creating barchart using ng2-chart library for charts. I got the following error while ng serve
:
ERROR in node_modules/chartjs-plugin-datalabels/types/index.d.ts(5,16): error TS2665: Invalid module name in augmentation. Module 'chart.js' resolves to an untyped module at '/node_modules/chart.js/src/chart.js', which cannot be augmented.
I want some datalabels on barchart.
So I added 'chartjs-plugin-datalabels' in component.
When I add following lines in my code, this error occurs.
import * as pluginDataLabels from 'chartjs-plugin-datalabels';
export class AnalysisComponent implements OnInit {
public barChartPlugins = [pluginDataLabels];
}
Version of libraries
"chart.js": "^2.7.3",
"ng2-charts": "^1.6.0",
"chartjs-plugin-datalabels": "^0.6.0",
Any help will be appreciated.
Per this comment you have to install @types/chart.js. And you have to import this lib with
import * as Chart from 'chart.js';