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

simply-chart

v1.1.2

Published

A number tendency Chart lib with canvas

Downloads

5

Readme

simply-chart

The simply-chart is a canvas chart lib without fancy style.It only create the chart with number tendency. It means the number from 0 to 100 and 0 to 1000 will be same in the simply-chart.

Installation

npm install --save simply-chart

Usage

import Chart from 'simply-chart';

const basicConifg = {
    base: {
        width: 200,
        height: 100,
        renderType: 'none',
        renderTime: 200 / 60,
        framePerSecond: 60,
    },
    attr: {
        lineWidth: 2,
    },
};

// line chart
const chart = new Chart.line({
    ...basicConifg,
    base: {
        dom: document.getElementById('test'),
        renderType: 'point',
    },
});
chart.update([1, 2.5, 3, 2.5, 1]).render();

Chart Support

The characteristics of simply-chart is simply, so it only support the simply chart syle now.

  • line line
  • bar bar

API

  • Chart.line(class Line)

    • constructor(conifg: IConfig)

    • methods:

      • update(data: number[]): Line update the data in chart.
      • render(): Line render chart.
    • Config:

      interface IConfig {
          base: BaseConfig;
          attr: LineConfig;
      }
  • Chart.bar

    • constructor(conifg: IConfig)

    • methods:

      • update(data: number[]): Line update the data in chart.
      • render(): Line render chart.
    • Config:

      interface IConfig {
          base: BaseConfig;
          attr: BarConfig;
      }
  • Config

    • BaseConfig

      | key | type | default | explain | | --------------- | ---------------------------------------- | ----------- | ---------------------------------------- | | dom | string(dom selector) | HTMLElement | | canvas init dom. | | width? | nubmer | 200 | canvas width. | | height? | number | 200 | canvas height. | | renderType? | string(enums) ['none', 'total', 'point'] | none | canvas animation type.none: no animationpoint: animation in point to pointtotal: animation in total line. | | renderTime? | number | 2 | animation time. | | renderCurve? | string | ease-in-out | canvas animation bezier-curve. could be a string or point string. Etc: '.68,0 ,1, 1'. | | framePerSecond? | number | 60 | canvas animation frame in 1 second. |

    • LineConfig

      | key | type | default | explain | | ---------- | ------ | ------- | ---------- | | color? | string | 'blue' | line color | | lineWidth? | number | 5 | line width |

    • BarConfig

      | key | type | Default | explain | | ---------- | -------- | ---------------------------------------- | ---------------------------------------- | | barWdith? | number | computed width width and data number. | each bar width. | | barRadius? | number | 5 | border-radius at top. | | colors? | string[] | ['red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple'] | color for each bar,(The length must more than the data length) |