0

I am currently building an Angular application to be hosted on the Cumulocity IoT platform, and I am trying to use Chart.js to generate custom bar charts. This did not work at first, so I did a little digging and discovered the special node package, ng2-chart, developed to employ Chart.js with Angular.

As it happens, I installed the latest version of each dependency, but I soon encountered errors trying to build and serve the application, among which is NG8002 that states:

Error: src/app/features/[..].component.html:81:17 - error NG8002: Can't bind to 'legend' since it isn't a known property of 'canvas'.

I did some research and found that this is likely due to the latest versions of Chart.js and ng2-chart being incompatible with my current development environment:

  • @angular/cli: 14.2.12
  • npm: 6.14.18
  • c8y/client: 1016.0.324

Has anyone else encountered this problem? What versions of Chart.js and ng2-chart could I use for my application?

liberlux
  • 85
  • 8

1 Answers1

1

i leave you a small image of the versions compatible with ng2-chart and an installation guide

enter image description here

Installation Guide

https://www.npmjs.com/package/ng2-charts

SeiryuV
  • 126
  • 5
  • Thank you. Is there a similar table that deals with Angular compatibility with chart.js? – liberlux Aug 23 '23 at 13:54
  • 1
    In the installation link that I have given you, they show you how to install chartjs together with ng2. In step number 2 – SeiryuV Aug 24 '23 at 06:07