How to implement chart.js in Angular2

后端 未结 6 1648
刺人心
刺人心 2020-12-14 09:19

I\'m using Angular2-rc4 with angular-cli webpack and would like to implement a chart.js library.

I\'ve installed chart.js to my project using:

6条回答
  •  死守一世寂寞
    2020-12-14 10:01

    Here is the best module out of few on npmjs:

    angular2-chartjs

    Then you can use it like this in your module:

    import { ChartModule } from 'angular2-chartjs';
    
    @NgModule({
      imports: [ ChartModule ]
      // ...
    })
    export class AppModule {
    }
    

    And in html template:

    
    

    Don't forget to fill it with data ;)

提交回复
热议问题