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

simple-doughnut-chart

v1.3.2

Published

doughnut chart

Downloads

34

Readme

simple doughnut chart

安装

npm i --save simple-doughnut-chart

特点

  • 兼容所有浏览器(包括ie6,7,8),需引入excanvas.js,请看git仓库示例代码
  • 更好的支持retina屏
  • 支持过渡动画(ie9及其他主流浏览器)

使用

import DoughnutChart from 'simple-doughnut-chart';

new DoughnutChart(document.getElementById('canvas'), {
    canvasSize: 150,            // canvas宽高大小
    doughnutSize: 12,           // 圆环直径大小
    defaultTextSize: 15,        // 默认文字大小
    activeTextSize: 25,         // 激活文本大小
    defaultColor: '#eee',       // 圆环默认颜色
    defaultTextColor: '#ccc',   // 默认文本颜色
    activeColor: '#13b0df',     // 圆环激活颜色
    percentageColor: '#13b0df', // 百分比文字颜色,如果未传,则为圆环激活颜色
    percentage: 88,             // 百分比,text不传或值为空字符串,则居中显示
    decimalPointDigit: 0,       // 保留的小数点位数,默认为0,如果小数点末尾为0,则不显示
    forceDecimalPointDigit: -1,  // 强制保留的小数点位数,默认为-1,不做强制处理,当值设置大于等于0时,且百分比小数点末尾为0,也将显示,将会覆盖decimalPointDigit的值
    text: '正确率',              // 文本
    duration: 1500,             // 动画持续时间,为0将禁用过渡动画
    dashWidth: 12,              // (百分比占位符)破折号宽
    dashHeight: 4,              // 破折号高
    dashMargin: 6,              // 破折号之间的间隔
    dashLength: 3,               // 破折号个数
    dashColor: '#eee',           // 破折号颜色

    // 1.3.0版本新增配置项
    textPosition: 'top',        // 文本位置,默认为bottom位于百分比下方,可选值(bottom|top)
    gradientColors: [],         // 适用于激活的圆环,圆环线型渐变颜色值,如[red, green],如果不是空数组将覆盖activeColor配置
    percentTextSize: 0,         // 百分数文字大小,如果该值大于0,将覆盖activeTextSize

    // 1.3.1版本新增配置项
    percentSymbolTextColor: '', // 百分比符号颜色,如果未设置或者为空,则内部取(percentageColor|activeColor)
    percentSymbolTextSize: 0,   // 百分比符号字体大小,如果未设置或者0,则内部取(percentTextSize|activeTextSize)
    percentSymbolTextBaseline: 'middle', // 百分比符号字体基线,默认为'middle',可选值(top|middle|bottom)
});

预览图