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

@momentum-design/charts

v1.0.0-alpha.21

Published

Chart components based on Chart.js for building dashboards

Downloads

13

Readme

@momentum-design/charts

A pure library based on web components and chart.js that is for building dashboards which can be used in any front-end framework.

All examples in website are using the JSX and online code editor to render charts in real time.

Installation

umd

The UMD build is also available on unpkg.com:

<link rel="stylesheet" href="https://unpkg.com/@momentum-design/charts/dist/charts.css" />
<script src="https://unpkg.com/@momentum-design/charts/dist/charts.umd.js"></script>

Then you can find the library on window.md.

npm

NPM is the easiest and fastest way to get started using this library. It is also the recommended installation method when building single-page applications (SPAs). It pairs nicely with a CommonJS module bundler such as Webpack.

# latest stable
$ npm i @momentum-design/charts

Use with Angular

  1. Import library and enable web component support in src/app/app.module.ts.

    import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    +import '@momentum-design/charts';
    
    import { AppComponent } from './app.component';
    
    @NgModule({
      declarations: [
        AppComponent,
      ],
      imports: [
        BrowserModule
      ],
      providers: [],
      bootstrap: [AppComponent],
    +  schemas: [CUSTOM_ELEMENTS_SCHEMA]
    })
    export class AppModule { }
  2. Use the components in your HTML template.

    <md-chart
      type="pie"
      data='{
             "Alabama": 13,
             "Colorado": 17,
             "Arizona": 8,
             "Vermont": 10,
             "South Carolina": 40
           }'
    ></md-chart>

Contributing

Prerequisites

Steps to Start

  1. Clone this repo.

  2. Install all dependencies via run command npm run init.

  3. Now, run npm start to start your work.

    • The component code should be placed to src/components. The new component should be structured as below:

      new-component
        ├─ index.ts                 // should export all public members
        ├─ new-component.ts         // the component code
        ├─ new-component.spec.ts    // unit tests
        ├─ new-component.types.ts   // all types definitions
        └─ new-component.plugins.ts // plugins of chart.js if need
    • The style file should be placed with component code and imported in src/styles/main.scss.

    • Also export the new component in src/components/index.ts file.

    • The internal folder dependency should be as below. That means we should not import anything from core folder into types folder or components into core folder.

      components ─⫸ core ─⫸ types
  4. Commit your changes and push them to your forked repo, and submit a Pull Request to main branch.

Styles Guides

  • Coding guidelines

    • Names
      • Use PascalCase for type names.
      • Do not use I as a prefix for interface names.
      • Use PascalCase for enum values.
      • Use camelCase for function names.
      • Use camelCase for property names and local variables.
      • Do not use _ as a prefix for private properties.
      • Use whole words in names when possible.
      • Use CONSTANT_CASE for the constants that is immutable.
  • Documentation Guide

Commit Message Guidelines

All commit message MUST follow Angular Commit Message Format.

Format as:

<type>(<scope>): <short summary>
  │       │             │
  │       │             └─⫸ Summary in present tense. Not capitalized. No period at the end.
  │       │
  │       └─⫸ Commit Scope: <component-name>
  │
  └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test

The <type> and <summary> fields are mandatory, the (<scope>) field is optional.

Useful Commands

  • npm run data will print the random data which is predefined in ./tools/data.ts and can be used to test your component. For example, npm run data -- --pie --default --5, npm run data -- --number --10 to get 10 random numbers.