/ng2-charts

Beautiful charts for Angular2 based on Chart.js

Primary LanguageTypeScriptMIT LicenseMIT

ng2-charts npm version

Beautiful charts for Angular2 based on Chart.js

Follow me at twitter to be notified about new releases.

Code Climate Join the chat at https://gitter.im/valor-software/ng2-bootstrap Dependency Status devDependency Status Throughput Graph

Usage & Demo

http://valor-software.github.io/ng2-charts/


Quick start

  1. A recommended way to install ng2-charts is through npm package manager using the following command:

npm i ng2-charts --save

  1. A way to install Chart.js component is through npm package manager using the following command:

bower install Chart.js --save

Alternatively, you can download it in a ZIP file.

After Chart.js component is downloaded, embed the code into your project.

<script src="bower_components/Chart.js/Chart.min.js"></script>
  1. Or you can link charts.js at cdn
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
  1. More information regarding using of ng2-charts is located in demo and demo sources.

API

Properties

  • data (Array<any>) - set of points of the chart, it should be Array<Array<number>> only for line, bar and radar, otherwise Array<number>
  • labels (?Array<any>) - x axis labels. It's necessary for charts: line, bar and radar. And just labels (on hover) for charts: polar area, pie and doughnut
  • chartType (?string) - indicates the type of charts, it can be: 'Line', 'Bar', 'Radar', 'Pie', 'PolarArea', 'Doughnut'
  • options (?any) - chart options (as from Chart.js documentation)
  • series (?Array<any>) - name points on the chart, work for line, bar and radar
  • colours (?Array<any>) - data colours, will use default colours if not specified (see readme for components)
  • legend: (?boolean=false) - if true show legend below the chart, otherwise not be shown

Events

  • chartClick: fires when click on a chart has occurred, returns information regarding active points and labels
  • chartHover: fires when mousemove (hover) on a chart has occurred, returns information regarding active points and labels

Troubleshooting

Please follow this guidelines when reporting bugs and feature requests:

  1. Use GitHub Issues board to report bugs and feature requests (not our email address)
  2. Please always write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.

Thanks for understanding!

License

The MIT License (see the LICENSE file for the full text)