Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 2.4 KB

primeng.md

File metadata and controls

65 lines (52 loc) · 2.4 KB

PrimeNG charts v6 configuration

Angular CLI commands

Note: ⚠️ ‼️ @angular/animations are not required, it was already installed with Angular Material

$ npm install primeng --save
$ npm install primeicons --save
$ npm install @angular/animations --save
$ npm install chart.js --save
$ npm install font-awesome --save

angular.json should have these additions

[...]
"styles": [
    [...],
    "node_modules/primeicons/primeicons.css",
    "node_modules/primeng/resources/themes/nova-light/theme.css",
    "node_modules/primeng/resources/primeng.min.css"
],
"scripts": [
    [...],
    "node_modules/chart.js/dist/Chart.js"
]
[...]

otherwise index.html should have these additions

<head>
  [...]
  <link rel="stylesheet" type="text/css" href="/node_modules/primeicons/primeicons.css" />
  <link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/themes/nova-light/theme.css" />
  <link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/primeng.min.css" />
  [...]
</head>
<body>
  [...]
  <script src="node_modules/chart.js/dist/Chart.js"></script>
</body>

Troubleshooting

It is thrown the following message: ERROR ReferenceError: "Chart is not defined" when chart.js dependency is not present in the project in either index.html or angular.json.

PrimeNG resources

Some alternatives to PrimeNG