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

table-charts

v0.0.2

Published

A web components that converts HTML tables into accessible charts

Readme

table-charts

A web component that converts HTML tables into accessible bar charts. Demo

Features

  • 📊 Convert any HTML table into a visual bar chart
  • ♿ Fully accessible with ARIA attributes
  • 🎨 Customizable bar colors via CSS custom properties
  • ⚙️ Configurable scale steps
  • 📱 Responsive and mobile-friendly
  • 🎯 Pure web component (no dependencies)
  • ⌨️ Full keyboard navigation support

Installation

npm install table-charts

Usage

Basic Example

<script type="module">
  import 'table-charts';
</script>

<table-bar-chart>
  <table>
    <caption>Quarterly Sales</caption>
    <tbody>
      <tr><td>Q1</td><td>$45,000</td></tr>
      <tr><td>Q2</td><td>$62,500</td></tr>
      <tr><td>Q3</td><td>$58,200</td></tr>
      <tr><td>Q4</td><td>$75,800</td></tr>
    </tbody>
  </table>
</table-bar-chart>

Attributes

hide-scale

Hide the scale on the left side of the chart.

<table-bar-chart hide-scale>
  <table>...</table>
</table-bar-chart>

scale-steps

Set the number of scale steps to display (minimum 2, default 4).

<table-bar-chart scale-steps="6">
  <table>...</table>
</table-bar-chart>

stacked

Render bars as stacked instead of grouped (for multi-series tables only).

<!-- Grouped bars (default) -->
<table-bar-chart>
  <table>...</table>
</table-bar-chart>

<!-- Stacked bars -->
<table-bar-chart stacked>
  <table>...</table>
</table-bar-chart>

Properties

hideScale

Get or set whether the scale is hidden.

const chart = document.querySelector('table-bar-chart');
chart.hideScale = true;

scaleSteps

Get or set the number of scale steps.

const chart = document.querySelector('table-bar-chart');
chart.scaleSteps = 6;

stacked

Get or set whether bars are rendered as stacked (only applies to multi-series tables).

const chart = document.querySelector('table-bar-chart');
chart.stacked = true;  // Enable stacked mode
chart.stacked = false; // Switch to grouped mode

Multi-Series Support

The component supports tables with multiple value columns. When a table has more than one value column (after the label column), bars are rendered in either grouped or stacked mode:

Grouped Bars (Default)

<table-bar-chart>
  <table>
    <caption>Revenue by Channel</caption>
    <thead>
      <tr><th>Quarter</th><th>Online</th><th>Retail</th></tr>
    </thead>
    <tbody>
      <tr><td>Q1</td><td>1200</td><td>800</td></tr>
      <tr><td>Q2</td><td>1500</td><td>1200</td></tr>
      <tr><td>Q3</td><td>1800</td><td>1100</td></tr>
    </tbody>
  </table>
</table-bar-chart>

Stacked Bars

<table-bar-chart stacked>
  <table>
    <caption>Revenue by Channel</caption>
    <thead>
      <tr><th>Quarter</th><th>Online</th><th>Retail</th></tr>
    </thead>
    <tbody>
      <tr><td>Q1</td><td>1200</td><td>800</td></tr>
      <tr><td>Q2</td><td>1500</td><td>1200</td></tr>
      <tr><td>Q3</td><td>1800</td><td>1100</td></tr>
    </tbody>
  </table>
</table-bar-chart>

CSS Customization

--bar-background-color

Customize the bar background color.

table-bar-chart {
  --bar-background-color: steelblue;
}

Requirements

  • The table must have a <tbody> element
  • The first column is treated as labels
  • The remaining columns are treated as numeric values (supports single or multiple series)
  • Values can include currency symbols, commas, or other formatting (they will be parsed)
  • Optional: <thead> with column headers for series names (displayed in legends for multi-series)

Browser Support

Works in all modern browsers that support:

  • Web Components (Custom Elements, Shadow DOM)
  • ES2020+

License

MIT