npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-donutchart

v1.0.3

Published

ngx-donutchart is an Angular component built with _TypeScript_, _HTML5_ and _Angular >= 4_. It is an Angular component for presenting donut charts in a light package with no external dependencies. The chart just consume your data and doesn't make any assu

Downloads

30

Readme

ngx-donutchart

ngx-donutchart is an Angular component built with TypeScript, HTML5 and Angular >= 4. It is an Angular component for presenting donut charts in a light package with no external dependencies. The chart just consume your data and doesn't make any assumptions about your datastructure or how you handle it.

Preview

Features

  • Handle large data sets (Virtual DOM)
  • Easy configuration and manipulation
  • Light codebase / No external dependencies
  • Easy selectors for testing purposes
  • AoT compilation support

Installation

All you need to do is to run the following command:

$ npm install ngx-donutchart --save

Usage

Import ngx-donutchart directives into your component:

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

...

import {NgXDonutChartModule} from 'ngx-donutchart';

Register it by adding to the list of directives of your module:

@NgModule({
  imports: [
    ...
    NgXDonutChartModule
  ],
  ...
})
export class AppModule {
}

Configure the chart and add it into the template by registering slices, size and innerRadius property.

import {NgXDonutChartSlice} from 'ngx-donutchart/ngx-donutchart.type';

slices: NgXDonutChartSlice[] | any[] = [ // exported type
    {
      value: 1,
      color: 'red'
    },
    {
      value: 2,
      color: 'green'
    },
    {
      value: 3,
      color: 'blue'
    }
];

size = 170;

innerRadius = 60

Add ngx-donutchart component inside to the template:

// ...

@Component({
    template: `
    <ngx-donutchart 
        [slices]="slices"
        [size]="size"
        [innerRadius]="innerRadius">
    </ngx-donutchart>
    `
})
// ...

Now you have some slices in your donut chart.

The event available with this component is:

  • onSliceHover

Add them as outputs to listen the events.

@Component({
    template: `
    <ngx-donutchart 
        [slices]="slices"
        [size]="size"
        [onSliceHover]="...($event)">
    </ngx-donutchart>
    `
})

Optionally you can add a title to the middle of your component by registering title:

@Component({
    template: `
    <ngx-donutchart 
        [title]="'NgXDonutChart'"
        [slices]="slices"
        [size]="size"
        [onSliceHover]="...($event)">
    </ngx-donutchart>
    `
})

License

MIT © jcunhafonte

Built with :heart: by jcunhafonte