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

handwritten-linegraph

v0.1.5

Published

A simple library to create handwritten-style line graphs and pie charts using D3.js

Readme

Handwritten Graph Library

Overview

A simple JavaScript library to create hand-drawn style charts inspired by comics and sketches. Built with D3.js, this library provides an easy-to-use API to generate fun, informal-looking graphs with customizable colors, labels, and data points.

Example

Here’s some example of a graph generated with this library: sample

Line charts

Example Handwritten Graph

Pie charts

Example Handwritten Graph

Features

  • Hand-drawn/sketched visual style
  • Line graphs with multi-series support
  • Pie charts with interactive segments
  • Donut chart option
  • Directional scribble and oil paint texture fill patterns
  • Tooltips with hover effects
  • Legend customization
  • Configurable hand-drawn effect

Installation

Install via npm:

npm install handwritten-graphs

Alternatively, you can use the library via CDN.

<script src="https://unpkg.com/[email protected]/dist/handwritten-graph.js"></script>

Usage

Line Graph

// Data format for line graphs
const lineData = {
  labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"],
  datasets: [
    {
      label: "Revenue",
      data: [65, 59, 80, 81, 56, 55, 40],
      lineColor: "rgb(75, 192, 192)"
    },
    {
      label: "Expenses",
      data: [30, 45, 51, 60, 48, 40, 35],
      lineColor: "rgb(255, 99, 132)"
    }
  ]
};

// Create a line graph
HandwrittenGraph.createGraph("#graph-container", lineData, {
  width: 800,
  height: 400,
  handDrawnEffect: true
});

Pie Chart

// Data format for pie charts
const pieData = [
  { label: "Marketing", value: 30, color: "#FF6384" },
  { label: "Development", value: 45, color: "#36A2EB" },
  { label: "Research", value: 15, color: "#FFCE56" },
  { label: "Administration", value: 10, color: "#4BC0C0" }
];

// Create a pie chart
HandwrittenGraph.createPieChart("#pie-chart-container", pieData);

// Create a donut chart
HandwrittenGraph.createPieChart("#donut-chart-container", pieData, {
  innerRadius: 80 // Setting innerRadius > 0 creates a donut chart
});

// Create a pie chart with directional scribble fills
HandwrittenGraph.createPieChart("#scribble-pie-chart", pieData, {
  useScribbleFill: true,
  fillStyle: 'directional' // Use directional scribble lines
});

// Create a pie chart with oil paint texture fills (no scribble lines)
HandwrittenGraph.createPieChart("#oilpaint-pie-chart", pieData, {
  useScribbleFill: true,
  fillStyle: 'oilpaint' // Use rich layered paint texture effect
});

Configuration Options

Line Graph Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | width | Number | 960 | Chart width in pixels | | height | Number | 500 | Chart height in pixels | | margin | Object | { top: 10, right: 10, bottom: 40, left: 50 } | Chart margins | | lineColor | String | 'steelblue' | Default line color (can be overridden in dataset) | | pointRadius | Number | 4 | Radius of data points | | fontFamily | String | 'xkcd' | Font family for text elements | | handDrawnEffect | Boolean | true | Enable/disable hand-drawn styling | | legendBorder | Boolean | false | Show border around legend | | handDrawnJitter | Number | 2 | Amount of jitter for hand-drawn effect | | valueFormat | Function | d3.format('.1f') | Format function for values in tooltip |

Browser Support

This library works in all modern browsers that support SVG and ES6.

Development

Setup

To install dependencies:

npm install

Building the Project

To build the project:

npm run build

License

MIT