Just a quick one for those struggling to get the PrimeNG charting components rendering. You might be importing the ChartModule just fine, and even setting up your component tags and data, but all you’re getting in the console is something like:

Error: Error in ./DashboardComponent class DashboardComponent - inline template:22:4 caused by: Chart is not defined

The bit of info you’re missing is that all of the PrimeNG charting components rely on you bundling Chart.js with your application. That’s the JavaScript library that supplies the Chart in Chart is not defined.

The easiest way to do that with Angular CLI is to first install the NPM package with:

npm install chart.js --save

Then bundle the library with your build by editing the angular-cli.json file in your root directory to include it in the scripts array like so:

"scripts": [
    "../node_modules/chart.js/dist/Chart.js"
  ], 

With those in-place, you’ll be ready to Chart up a storm.

Have fun!

Now you know the hack