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

animated-3d-piechart

v0.0.5

Published

Library for drawing nice looking pie/donate charts

Downloads

13

Readme

Animeted 3d piechart

This library is for drawing nice looking pie/donat charts with d3js.

Here is the link to the demo

image

##How to install

npm install animeted-3d-piechart

How to use it

In you html file you need to add any html tag with uniq id.

Example:

<div id="piechart"></div>

And add script:

import Dounat3D from 'animated-3d-pie';

var chartId = 'piechart';
var data = [10, 20, 30];
piechart3D.draw(chartId, data);

piechart3D.draw(chartid, data, config')

  • chartId - string, id of html that where chart should be placed
  • data - array of numbers or objects
  • config - object with chart config

Data

Data can be provided on two ways. The basic one is an array of numbers - example [10, 20, 30]. Each number will be treat as value for single part of the chart. Colors will be added automatic for each value.

Second way is to provide own array of objects with definitions of colors and/or lables.

Data with objects:

var data = [
  {
    value: 10,
      color: 'red',
      label: 'No'
  },
  {
    value: 20,
      color: 'green',
      label: 'Yes'
  },
  {
    value: 5,
      color: 'silver',
      label: 'Others'
  }
];
  • value - number
  • color - string
  • label - string

Config

config - Object

| Parameter | Default | Decryption | |-------------------|---------|---------------------------------------------| |ir | 0 |Number (min: 0, max: 100) Inner radius in % | |h | 20 |Number (min: 0) Height of walls in px | |angle | 45 |Number (min: 0, max: 90) Angle of chart in degrees, when 90 the chart become normal flat pie chart | |size | 100 |Number (min: 0, max: 100) size in inner html tag in % | |animationDuration| 750 |Number (min: 0) time in ms of drawing the chart | |fontSize | 12 |Number (min: 0) label and tooltip font size in px | |animatedSlices | true |Boolean if false the slices are not click-able | |label | labelFunction | Function/Boolean if false there will be no labels on the chart, d => {}| |linesColor | 'black' | Function/String color for the lines, d => {}| |labelColor | 'black' | Function/String color for the lables, d => {}| |onSliceSelect | null | Function on slice click, d => {} | |tooltip | tooltipFunction| Function tooltip text, d => {} | |tooltipColor | black | Function/String color of the tooltips, d => {} |

d => {} - function that depends on d.

d = {
  data: {
      color: ...,
        value: ...,
        label: ...
    },
    index: ...,
    startAngle: ...,
    endAngle: ...,
    value: ...
}

Example of function d => {}:

tooltipFunction: d => `${Number(d.value).toFixed(2)}`

Update

Update chart if config or data changed.

piechart3D.update(chartId, data, config)

License

MIT License 2016 © woles