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

custom-chart

v0.1.0

Published

A customizable React chart library with multiple chart types including bar, line, area, pie, donut, and more

Downloads

106

Readme

Custom Chart

A lightweight, customizable React chart library with multiple chart types built with SVG.

Installation

npm install custom-chart
# or
yarn add custom-chart

Features

  • 🎨 Multiple Chart Types: Bar, Line, Area, Pie, Donut, Polar, and more
  • 🎯 Highly Customizable: Extensive configuration options for colors, labels, legends, and animations
  • 📦 Lightweight: No heavy dependencies, built with pure React and SVG
  • 🎭 TypeScript Support: Full TypeScript definitions included
  • Performance Optimized: Efficient rendering with memoization

Available Charts

  • BarChart - Vertical bar charts
  • LineChart - Line charts with customizable styling
  • AreaChart - Area charts with fill colors
  • PieChart - Pie charts with legend support
  • DonutChart - Donut charts with customizable inner radius
  • VariableRadiusPieChart - Pie charts with variable segment sizes
  • StackedColumnChart - Stacked column charts
  • GroupedColumnChart - Grouped column charts
  • LineRaceChart - Animated racing line charts
  • ColumnRangeChart - Column range charts
  • PolarChart - Polar/Radar charts
  • PieDrilldownChart - Pie charts with drilldown functionality
  • RadialBarChart - Radial bar charts
  • DualAxesChart - Charts with dual Y-axes
  • SynchronizedCharts - Multiple synchronized charts
  • ColumnWithNegativeChart - Column charts supporting negative values
  • MultiAreaChart - Multiple overlapping or stacked area charts
  • MultiLineChart - Multiple line charts
  • AnimatedLineChart - Line charts with custom entrance animations

Quick Start

import React from 'react';
import { BarChart } from 'custom-chart';

function App() {
  const labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May'];
  const data = [10, 20, 30, 40, 50];
  
  const configs = {
    xAxisName: 'Month',
    YAxisName: 'Sales',
    backgroundColor: ['#3498db', '#2ecc71', '#e74c3c', '#f39c12', '#9b59b6'],
    borderColor: ['#2980b9', '#27ae60', '#c0392b', '#e67e22', '#8e44ad'],
    borderWidth: 2,
    numYTicks: 5
  };

  return (
    <BarChart
      labels={labels}
      data={data}
      configs={configs}
    />
  );
}

export default App;

Examples

Line Chart

import { LineChart } from 'custom-chart';

<LineChart
  labels={['Mon', 'Tue', 'Wed', 'Thu', 'Fri']}
  data={[20, 25, 30, 22, 28]}
  configs={{
    xAxisName: 'Day',
    YAxisName: 'Temperature (°C)',
    strokeColor: '#3498db',
    strokeWidth: 2,
    showPoints: true
  }}
/>

Pie Chart

import { PieChart } from 'custom-chart';

<PieChart
  labels={['Red', 'Blue', 'Green', 'Yellow']}
  data={[30, 25, 20, 25]}
  configs={{
    showLegend: true,
    legendPosition: 'right',
    backgroundColor: ['#e74c3c', '#3498db', '#2ecc71', '#f1c40f']
  }}
/>

Donut Chart

import { DonutChart } from 'custom-chart';

<DonutChart
  labels={['Desktop', 'Mobile', 'Tablet']}
  data={[60, 30, 10]}
  configs={{
    innerRadius: 50,
    showLegend: true,
    backgroundColor: ['#3498db', '#2ecc71', '#e74c3c']
  }}
/>

Animated Line Chart

import { AnimatedLineChart } from 'custom-chart';

<AnimatedLineChart
  labels={['Q1', 'Q2', 'Q3', 'Q4']}
  series={[
    {
      data: [10, 20, 15, 25],
      label: 'Sales',
      strokeColor: '#3498db',
      showPoints: true
    },
    {
      data: [5, 15, 10, 20],
      label: 'Revenue',
      strokeColor: '#2ecc71',
      showPoints: true
    }
  ]}
  configs={{
    animationType: 'draw',
    animationDuration: 1500,
    enableAnimation: true,
    showLegend: true
  }}
/>

Configuration Options

Each chart type has its own configuration options. Common options include:

  • xAxisName - Label for X-axis
  • YAxisName - Label for Y-axis
  • numYTicks - Number of Y-axis ticks
  • showLegend - Show/hide legend
  • legendPosition - Position of legend ('top', 'bottom', 'left', 'right')
  • backgroundColor - Array of background colors
  • borderColor - Array of border colors
  • borderWidth - Border width

See individual chart documentation for specific options.

TypeScript

Full TypeScript support is included. All components are typed and exported with their interfaces.

import { BarChart, LineChart } from 'custom-chart';

Development

# Install dependencies
npm install

# Run Storybook for development
npm run storybook

# Build library
npm run build:lib

# Build Storybook
npm run build-storybook

# Build Storybook for GitHub Pages
npm run build-storybook:gh-pages

GitHub Pages Deployment

This project includes automatic deployment of Storybook to GitHub Pages via GitHub Actions.

Setup Instructions:

  1. Update package-lock.json (if needed):

    npm install

    This ensures your lock file is in sync with package.json.

  2. Enable GitHub Pages in your repository settings:

    • Go to Settings → Pages
    • Source: Select "GitHub Actions"
  3. Automatic Deployment:

    • Push to main or master branch
    • GitHub Actions will automatically build and deploy Storybook
    • Your Storybook will be available at: https://{username}.github.io/{repo-name}/
    • The workflow automatically detects your repository name and sets the correct base path
  4. Manual Deployment:

    npm run build-storybook:gh-pages
    # Then manually push the storybook-static folder if needed

Troubleshooting:

  • If you see lock file errors, run npm install locally and commit the updated package-lock.json
  • The workflow uses Node.js 20 to satisfy all dependency requirements

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.