GithubHelp home page GithubHelp logo

fadak0828 / ng2-charts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from valor-software/ng2-charts

0.0 1.0 0.0 27.65 MB

Beautiful charts for Angular2 based on Chart.js

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

License: MIT License

JavaScript 25.25% TypeScript 74.75%

ng2-charts's Introduction

ng2-charts npm version npm downloads slack

Beautiful charts for Angular2 based on Chart.js

NPM NPM

Usage & Demo

Sample in below website uses [email protected]

http://valor-software.github.io/ng2-charts/ http://plnkr.co/edit/7fGsiuRjcF0M0Ffeoml2?p=preview


Installation

  1. You can install ng2-charts using npm
npm install ng2-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/src/chart.js"></script>

Usage & Demo

Demo and API details of ng2-charts can be found here: demo and source code.

System.js

System.js bundles can be found in bundles directory of npm package or at npm cdn

API

Import

import { ChartsModule } from 'ng2-charts/ng2-charts';

// In your App's module:
imports: [
   ChartsModule
]

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.

Properties

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

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

Colors

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.

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)

ng2-charts's People

Contributors

valorkin avatar greenkeeperio-bot avatar natali-abyss avatar otelnov avatar hongbo-miao avatar namek avatar tiedye avatar amitmy avatar uwouldllose avatar anthony-pinskey avatar alfakappa avatar bradynadeau avatar ihadeed avatar jmmesquitacardoso avatar explodingcabbage avatar bbrink68 avatar nestyko avatar puigcerber avatar prashanthmadi avatar sergeykuryatnick avatar charsleysa avatar zackarychapple avatar m0t0r avatar sahlouls avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.