🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ng2-charts7

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-charts7

A revival of the "valor-software/ng2-charts" Angular library - updated for Angular 7

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

ng2-charts7 npm version npm downloads

Beautiful charts for Angular2 based on Chart.js

NPM NPM

Original repo at https://github.com/valor-software/ng2-charts

Usage & Demo

StackBlitz Demo

Installation

  • You can install ng2-charts7 using npm
npm install ng2-charts7 --save
  • You need to install chart.js library (it is a peer dependency of this library) (more info can be found in official chart.js documentation)
npm install chart.js --save

API

Import

import { ChartsModule } from 'ng2-charts7';

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

  • Use GitHub Issues board to report bugs and feature requests (not our email address)
  • 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)

Keywords

chart.js

FAQs

Package last updated on 03 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts