1.0.0 • Published 4 years ago

ang-donut v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Angular Donut

A simple donut in angular.

Getting Started

To use ang-donut in your project install it via npm.

Live demo here

Install ang-donut

npm i ang-donut

In app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { CommonModule } from '@angular/common';
import { DonutModule } from 'ang-donut';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    DonutModule,
    CommonModule 
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

In app.component.html

<ng-donut 
[donutData]='donutData' 
[innerLabel]='innerLabel' 
[showTotal]='showTotal' 
[dim]='dim' 
[showLegend]='legend'>
</ng-donut>

In app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  innerLabel = 'Colors';
  legend = true;
  dim = [500, 500];
  showTotal = true;
  donutData = [
    { name: 'Red', value: '30', color: '#E25325' },
    { name: 'Blue', value: '20', color: '#6064CF' },
    { name: 'Black', value: '40', color: '#5A5C59' },
    { name: 'Green', value: '10', color: '#50FD1D' }
  ];
}

Properties

NameDescriptionType
donutDataspecifies the data to be send to donutArray of objects having properties name , value and color(hexcode) as strings.
innerLabellabel to be shown inside the donutstring
showTotalshould total be shown inside the donutboolean
dimdimensions of the donutArray of two numbers where first value represents height and second value represents width
showLegendshould legend be shown inside donutboolean

License

MIT

1.0.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago