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

divchart

v1.0.2

Published

A simple chart library that works purely with HTML data attributes.

Readme

DivChart

A simple, declarative charting library that works purely with HTML data attributes. DivChart is an easy way, to render data in a simple graph.

Features

  • Pure HTML data attributes (or props w/ React) configuration
  • Automatic axes and labels
  • Interactive tooltips
  • Responsive design
  • React support
  • Zero dependencies
  • Lightweight

Installation

NPM

npm install divchart

Then import and use in your project:

import { DivChart } from 'divchart';

Note: there is a dedicated React component. Instructions for that are detailed below.

CDN

Add the script directly into your HTML:

<script src="https://unpkg.com/divchart"></script>

Usage

Basic HTML

Simply add data attributes to your div:

<div class="chart"
  data-divchart="line"
  data-divchart-title="Monthly Sales"
  data-divchart-data='[
    {"label": "Jan", "value": 30},
    {"label": "Feb", "value": 45},
    {"label": "Mar", "value": 35},
    {"label": "Apr", "value": 60},
    {"label": "May", "value": 60},
    {"label": "Jun", "value": 60},
    {"label": "Jul", "value": 30},
    {"label": "Aug", "value": 60},
    {"label": "Sep", "value": 20},
    {"label": "Oct", "value": 60},
    {"label": "Nov", "value": 10},
    {"label": "Dec", "value": 100}
  ]'
  data-divchart-colors='["#2196F3"]'>
</div>

This generates the following chart: divchart line graph

React Usage

Import DivChart and use it directly in your React components:

import { Chart } from 'divchart';

function App() {
  const data = [
    { label: "Jan", value: 30 },
    { label: "Feb", value: 45 }
  ];

  return (
    <div className="App">
      <Chart 
        type="bar"
        data={data}
        title="Test Chart"
        style={{ width: '600px', height: '400px' }}
      />
    </div>
  );
}

Feel free to wrap the div (or component) in any stylized tags e.g. placing a border around the graph.

Documentation

Chart Types

  • Line Chart: data-divchart="line"
  • Bar Chart: data-divchart="bar"
  • Pie Chart: data-divchart="pie"

Configuration Options

  • Title: data-divchart-title="My Chart"
  • Data: data-divchart-data='[{"label": "A", "value": 10}, {"label": "B", "value": 20}]'
  • Colors: data-divchart-colors='["#4CAF50", "#2196F3", "#FFC107"]'. Note: for graph types like bar and pie, you can pass in multiple colors as shown. This would reflect based on the index of the data piece. E.g. the first data point you pass into divchart-data would correlate with the first color in the array.
  • Type: data-divchart="["line"]

Future considerations

  • More graph types (scatter, radar, doughnut, stacked bar/line)
  • More UI customizations (custom fonts, sizing, subtitles, animations)
  • Ability to pass in y and x axis data through separate attributes (easier data manipulation)

License

MIT