TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    ng4-charts npm version

    Fork of beautiful charts for Angular4 based on Chart.js originally developed by



    1. You can install ng4-charts using npm
    npm install ng4-charts --save
    1. 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)
    npm install chart.js --save

    Important: Embedding Chart.js in application is mandatory!

    <script src="node_modules/chart.js/dist/chart.js"></script>

    Usage & Demo

    Demo and API details of ng4-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



    import { ChartsModule } from 'ng4-charts/ng4-charts';
    // In your App's module:

    Chart types

    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 tooltips
    • labels (?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 shown


    • 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


    There 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:

    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!


    The GNU GENERAL PUBLIC LICENSE v3 License (see the LICENSE file for the full text)


    npm i ng4-charts

    DownloadsWeekly Downloads






    Last publish


    • krish512