Angular Pie Chart
To start implementing, visit the below link:
https://www.npmjs.com/package/ng2-charts/v/3.0.0-rc.2
and follow the instructions it mentions, going with the flow I will show you how it impacts your projects File structure:
You can install ng2-charts using npm
npm install ng2-charts@next --save
npm install chart.js --save
import { ChartsModule } from 'ng2-charts';// In your App's module:imports: [ChartsModule]
Schematics
There are schematics that may be used to generate chart components using Angular CLI. The components are defined in package ng2-charts-schematics.
Installation of Schematics Package
npm install --save-dev ng2-charts-schematics
Example of Generating a Line Chart using Angular CLI
ng generate ng2-charts-schematics:line my-line-chart
This calls angular's component schematics and then modifies the result, so all the options for the component schematic are also usable here. This schematics will also add the ChartsModule as an imported module in the main app module (or another module as specified in the --module command switch).
But it throws this error:
- https://valor-software.com/ng2-charts/#BarChart
- https://github.com/valor-software/ng2-charts/issues/1459
- https://stackoverflow.com/questions/73103388/ng0303-cant-bind-to-type-since-it-isnt-a-known-property-of-canvas
- https://www.npmjs.com/package/ng2-charts/v/3.0.0-rc.2
- https://www.tutsmake.com/angular-11-pie-chart-tutorial-with-ng2-charts-example/
- https://www.freakyjolly.com/angular-chart-js-tutorial-using-ng2-charts-with-examples/
Comments
Post a Comment