Name: ng2-charts
Owner: Valor Software
Description: Beautiful charts for Angular based on Chart.js
Created: 2015-08-27 10:34:52.0
Updated: 2018-05-23 10:52:47.0
Pushed: 2018-05-11 14:18:17.0
Homepage: http://valor-software.github.io/ng2-charts/
Size: 28309
Language: TypeScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Beautiful charts for Angular2 based on Chart.js
Sample in below website uses ng2-charts@1.1.0
http://valor-software.github.io/ng2-charts/ http://plnkr.co/edit/7fGsiuRjcF0M0Ffeoml2?p=preview
You can install ng2-charts using npm
install ng2-charts --save
You need to install and include Chart.js
library in application via html
or webpack bundler
(more options can be found in official chart.js
documentation)
install chart.js --save
Important: Embedding Chart.js
in application is mandatory!
ipt src="node_modules/chart.js/src/chart.js"></script>
Demo and API details of ng2-charts can be found here: demo and source code.
System.js bundles can be found in bundles
directory of npm package or at npm cdn
rt { ChartsModule } from 'ng2-charts/ng2-charts';
n your App's module:
rts: [
hartsModule
There are one directive for all chart types: base-chart
, and there are 6 types of charts: , line
, bar
, radar
, pie
, polarArea
, doughnut
.
Note: For more information about possible options please refer to original chart.js documentation
data
(Array<number[]> | number[]
) - set of points of the chart, it should be Array<number[]>
only for line
, bar
and radar
, otherwise number[]
;datasets
(Array<{data: Array<number[]> | number[], label: string}>
) - data
see about, the label
for the dataset which appears in the legend and tooltipslabels
(?Array<any>
) - x axis labels. It's necessary for charts: line
, bar
and radar
. And just labels (on hover) for charts: polarArea
, 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)colors
(?Array<any>
) - data colors, will use default and|or random colors if not specified (see below)legend
: (?boolean=false
) - if true show legend below the chart, otherwise not be shownchartClick
: fires when click on a chart has occurred, returns information regarding active points and labelschartHover
: fires when mousemove (hover) on a chart has occurred, returns information regarding active points and labelsThere are a set several default colors. Colors can be replaced using the colors
attribute. If there is more data than colors, colors are generated randomly.
Please follow this guidelines when reporting bugs and feature requests:
Thanks for understanding!
The MIT License (see the LICENSE file for the full text)