Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-d3-charts

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-d3-charts

Integrate angular 2 app with interactive d3 charts e.g. Doughnut, Pie, Single Bar chart, Multiple bar chart and Stacked bar chart. Beautiful charts for Angular2 based on d3.js

  • 2.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
536
increased by72.9%
Maintainers
1
Weekly downloads
 
Created
Source

Integrate angular 2 app with interactive d3 charts e.g. Doughnut, Pie, Single Bar chart, Multiple bar chart and Stacked bar chart.

Beautiful charts for Angular2 based on d3.js

Getting Started

npm install angular-d3-charts --save

Notice: the latest version on NPM may not reflect the branch master. Open an issue and tag me if you need it to be published.

Configuration

Ensure you import the module:

import { DoughnutChartComponent, PieChartComponent } from 'angular-d3-charts'; // this is needed!

@NgModule({
   declarations: [ 
   DoughnutChartComponent, 
   PieChartComponent, 
   ...OtherModules 
   ] // along with your other modules
})
export class AppModule {}

Usage

Doughnut Chart:

<angular-d3-donut [data]="donutChartData" ></angular-d3-donut>   
donutChartData = [{
      id: 0, // number
      label: 'label name',  // string
      value: value,  // number
      color: 'color of slice',  // string,
      iconImage: 'path of image' // string
   },
      id: 1, // number
      label: 'label name',  // string
      value: value,  // number
      color: 'color of slice',  // string,
      iconImage: 'path of image' // string
   }, ...
   ]

Attributes

Attributes of angular-d3-donut are

It can contain the following properties.

Input

OptionDefaultTypeDescription
outerRadius150NumberOuter radius of the donut chart. (Recommended to not to larger than 150)
innerRadius70NumberInner radius of the donut chart.
dataNot setObjectAs above mentioned
centerImageNot setStringPath of center image in donut.
spreadSliceFalseBooleanIf you want to spread out the slide.

Output

OptionDescription
centerImageEventWhen cemter image is clicked, the centerImageEvent function triggers.
<angular-d3-donut [spreadSlice]=true [centerImage]='centerImage' [data]="donutChartData" (centerImageEvent)="centerImageEvent()"></angular-d3-donut>
In your.component.ts file write
public centerImageEvent() {
 // Perform action here
}

Pie Chart:

<angular-d3-pie [data]="pieChartData" ></angular-d3-pie>   
pieChartData = [{
      id: 0, // number
      label: 'label name',  // string
      value: value,  // number
      color: 'color of slice',  // string,
   },
      id: 1, // number
      label: 'label name',  // string
      value: value,  // number
      color: 'color of slice',  // string,
   }, ... ]

Attributes

Attributes of angular-pie-donut are

It can contain the following properties.

Input

OptionDefaultTypeDescription
outerRadius150NumberOuter radius of the donut chart. (Recommended to not to larger than 150)
dataNot setObjectAs above mentioned
spreadSliceFalseBooleanIf you want to spread out the slide.
<angular-d3-pie [spreadSlice]=true [data]="pieChartData" [outerRadius]=90></angular-d3-pie>

Keywords

FAQs

Package last updated on 15 Sep 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc