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 🙏

© 2026 – Pkg Stats / Ryan Hefner

svg-pie

v0.1.2

Published

Vector pie charts with D3

Readme

svg-pie

svg-pie is a free, open source module for creating responsive vector pie charts. Based on D3 v.4

Installation

From NPM :

  • npm install svg-pie

Download:

Examples:

Features

  • tooltips
  • custom color range
  • color interpolation
  • customizable inner radius (doughnut version)
  • different input formats (number, array, array of objects)
  • sorting
  • responsive
  • animation

Usage

DOM

Add <div id="chart"></div> where you want to place a pie chart. Feel free to add any content between <div> and </div>. It'll be centered.

Javascript

The module return a constructor that accepts two parameters: selector and options

CommonJS

var SvgChart = require('svg-pie')
var chart = new SvgChart('#chart', options)

Browser

Use svg-pie.min.js together with D3:

<script src="https://d3js.org/d3.v4.js"></script>
<script src="svg-pie.min.js" charset="utf-8"></script>
<script type="text/javascript">
  var chart = new SvgPie('#chart', {data: {...}, options: {...}})
</script>

svg-pie.bundle.min.js includes all needed dependencies:

<script src="svg-pie.bundle.min.js" charset="utf-8"></script>
<script type="text/javascript">
  var chart = new SvgPie('#chart', {data: {...}, options: {...}})
</script>

Data & Options

Data and Options are objects you pass to constructor. Like that:

new SvgPie('#chart1', {
    data: {
        dataset: [
            {label: 'Label 1', value: 65},
            {label: 'Label 2', value: 35},
        ]
    },
    options: {
        innerRadiusSize: .7,
        transition: 2000,
        initialTransition: true,
        sort: true,
        colors: ['#44DDDD','#EEEEEE']
    }
})

Data

Options

Style

By default a chart, its inner content and a tooltip have no styling. To style the tooltip use CSS and .csv-tooltip, .csv-tooltip-label, .csv-tooltip-value selectors. For example:

.csv-tooltip {
  font-size: .8em;
  background: white;
  box-shadow: 0 0 10px rgba(0,0,0,.2);
  padding: 10px;
  opacity: .8;
}
.csv-tooltip-label {
  font-size: 1.2em;
  font-weight: bold;
}

To style inner content of the chart add your own DOM elements:

<div id="chart">
  <div class="your-new-element">70%</div>
</div>