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

ben-canvas

v1.1.6

Published

a canvas tool lib

Readme

Api Document

import DataCanvas from 'ben-canvas';
line
DataCanvas.line({
    lineWidth: 2, // The thickness of the line. optional.
    color: '#F00', // the color of the line. optional.
    points:[
        {
            x: 0.123,   // percentage
            y: 0.123,   // percentage
        }, {
            // ...
        }
    ]
});
rect
DataCanvas.rect({
    lineWidth: 2, // The width of the rect border. optional.
    color: '#FF0', // the color of the rect border. optional.
    position: {
        x: 0.123,  // the x coordinate of left-top point of the rectangle in percentage
        y: 0.123   // the y coordinate of left-top point of the rectangle in percentage
    },
    width: 0.123,  // percentage
    height: 0.123  // percentage
});
text
DataCanvas.text({
    size: 14, // The font-size of the text. Optional.
    lineHeight: 18, // The line-height of the text. Optional.
    color: '#F00',  // The color of the text. Optional.
    position: {
        x: 0.123,  // percentage
        y: 0.123   // percentage
    },
    width: 0.123,   // percentage
    height: 0.123  // percentage
});
ellipse
DataCanvas.ellipse({
    lineWidth: 2, // The width of the ellipse border. optional.
    points: [
        {x: 0.1, y: 0.1},
        {x: 0.9, y: 0.9}
    ]
});
ease
DataCanvas.ease({
    lineWidth: 2, // The thickness of the ease pen. optional.
    points: [
        {x: 0.1, y: 0.1},  // The trajectory which you want to ease;
        {x: 0.9, y: 0.9},
        // .....
    ]
});
clear
DataCanvas.clear(); // 清楚整个画布

Change Log

1.1.1 (2018-05-15)
  • [需求] 实现箭头接口。
1.1.0 (2017-09-30)
  • [需求] 实现椭圆接口。
1.0.5 (2017-09-13)
  • [优化] 文字工具的字体可配置,默认使用 win 和 mac 上表现差不多的字体。
1.0.4 (2017-09-06)
  • [需求] 文字 text 方法可配置文字的大小和行高。
1.0.2 (2017-08-21)
  • [需求] 画笔粗细和橡皮擦大小可配置。
1.0.1 (2017-08-04)
  • [bug] 修复在画矩形时会再次重绘上次的直线数据。
1.0.0 (2017-08-03) 👏
  • [feature] 提供画图功能类库。

Contact

Author: Ben Chen

E-mail: [email protected]

Contributor: Gao Yong

E-mail: [email protected]