0.0.4 • Published 6 years ago
ngx-doughnut-chart v0.0.4
ngx-doughnut-chart
ngx-doughnut-chart
is a light weight with no dependencies angular component to draw donut charts using svgs.
Installation
All you need to do is to run the following command:
$ npm i ngx-doughnut-chart --save
or
$ yarn add ngx-doughnut-chart --save
Usage
Import NgxDonutChartModule module into your main module and add it to imports:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgxDonutChartModule } from 'ngx-doughnut-chart';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgxDonutChartModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
...
Pass data like this:
```typescript
donutChartData = [
{
label: 'Liverpool FC',
value: 5,
color: 'red',
},
{
label: 'Real Madrid ',
value: 13,
color: 'black',
},
{
label: 'FC Bayern München',
value: 5,
color: 'blue',
},
];
and then use the component in your html like:
<ngx-donut-chart
[data]="donutChartData"
[title]="'Sessions'"
[radius]="88"
[thickness]="10"
[margin]="30">
</ngx-donut-chart>
License
MIT © ahmedbassell