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

cs-charts

v0.0.2

Published

Lightweight opinionated chart library (line, donut and bar charts)

Downloads

3

Readme

cs-charts

Lightweight opinionated chart library (line, donut and bar charts)

NPM Version NPM Downloads Linux Build Test Coverage Known Vulnerabilities

Installation

$ yarn add cs-charts
# or
$ npm install cs-charts

Features

  • Lightweight (3kb)
  • Line Charts
  • Bar Charts
  • Animated Donut
  • Mobile Friendly

API

csCharts(options)

Boots up the cs-charts, creates all the elements, builds dynamic axis and create the charts

  • options an object that is passed to cs-charts on setup

csCharts.version

Returns the current version of cs-charts you are using

Options

var options = {};

var chart = new csCharts(options)

options.snap

Type: Function Default value: undefined Required: true

Import of your SnapSvg library

options.series

Type: array Default value: undefined Required: true

The data to plot, for more information on the data format then please check Data Object.

Data Object

A series is presented with an array of objects. You can have multiple series.

var series = [
    {
        name: 'My Series',
        color: '#DFDFDF',
        default: true,
        constant: true,
        parent: 'Another Series',
        label: function(){
            // format function
        },
        data: [
            // series data
        ]
    }
]

series.name

Type: string Required: true

The name of the series

series.color

Type: string Required: true

The colour of the series

series.default

Type: boolean Default value: false

This sets the default line to be active on initial load. You should only have 1 series with this attribute. If you have more then one, its the first series found.

series.constant

Type: string Default value: false

When set to true this series will always be available even when viewing other series children.

series.parent

Type: string

Add the name of another series. This will mean this series is hidden until the parent series is clicked.

series.label

Type: function

This function provides ability to customise the label shown on the line.

// Format the unix timestamp to be a readable date
label: {
    name: "visits",
    formatter: function (value) {
        const date = new Date(parseInt(value, 10)).toDateString();
        return date;
    }
}

series.data

Type: array Required: true

The array of data to be plotted.

Docs & Community

Examples

You can find examples of implementation within the examples folder.

You can run the examples locally.

$ git clone [email protected]:ProjectRogueOne/cs-charts.git

Install dependencies

$ yarn install
# or
$ npm install

Run the examples express app

$ npm run examples

You should now be able to see the examples on http://locahost:3000

Tests

To run the test suite, first install the dependencies, then run npm test:

$ yarn install
$ npm test

Releasing

A new version will automatically be released when the master branch is tagged.

To tag the master branch run npm run release.

The following will happen when you run npm run release.

  • Bump the package.json version
  • Updates CHANGELOG
  • Commits the changes
  • Pushes commit and tag to git
  • Travis picks up tag and run tests
  • Passes tests and Travis runs npm run postrelease (add release notes to version in GitHub)
  • Travis pushes new build to NPM

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Commits

This project follows the Conventional Changelog Standard. Any pull requests that dont follow this standard will be rejected.

License

MIT © ClearScore