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

@markset-lang/chart-table

v0.4.2

Published

Draws a figure's table as a chart (spec §11). An engine, not part of the renderer.

Readme

@markset-lang/chart-table

Draws a data table as a line, bar or column chart. A pure function with no dependencies that returns an SVG as a hast tree, with no color in it.

npm i @markset-lang/chart-table
# or
pnpm add @markset-lang/chart-table
import { chart } from "@markset-lang/chart-table";

const svg = chart("line", {
  categoryLabel: "Quarter",
  categories: ["Q1", "Q2", "Q3", "Q4"],
  series: [
    { name: "Baseline", values: [120, 128, 141, 150] },
    { name: "Forecast", values: [120, 131, 149, 172] },
  ],
});

Returns a hast element node for an <svg>, or null when there is nothing to draw. The tree drops straight into any hast pipeline, or into hast-util-to-html for a string.

The data

The shape mirrors a table, which is what spec §11 says a chart is drawn from: the first column is the category axis in document order, every other column is a series named by its header, and a non-numeric cell is a gap (null), never a zero.

| Type | Categories run | Use for | |---|---|---| | line | across | Ordered periods, where the shape between points is the argument | | column | across | A few categories compared by height | | bar | down | Long names or ranked lists, read top to bottom |

Bars start at zero, because a bar encodes magnitude as length and a truncated baseline misstates the ratio. Lines fit their data, because a line encodes magnitude as position and forcing zero flattens the shape the chart exists to show. A bar chart's left margin is measured off its longest label so nothing is clipped, and colliding labels along a horizontal axis are thinned rather than overlapped.

No color, on purpose

The output carries geometry and series identity — each mark has data-series="1" through "8" — and not one fill or stroke. The stylesheet colors it. In @markset-lang/render-html that is markset.css, whose eight chart hues were checked for lightness, chroma, colorblind separation and contrast against its own surfaces in both light and dark; a theme recolors every chart by setting --ms-chart-1 through --ms-chart-8. If you use this package on its own, you supply those rules.

Why a tree and not a string

The ASCII diagram engine returns an SVG string that the renderer wraps in an <img>, because a diagram engine may be an arbitrary command and raw markup from one is a channel documents are denied. This engine is not that: it constructs nodes, so there is no markup to parse and no channel to open, and inline SVG is what lets a stylesheet color the chart at all. In Markset the chart is placed in front of its table and never replaces it (§11, obligation 8): the picture is a lossy view of data the reader may want exactly.

Specification: https://markset.org/spec/. Source: https://github.com/markset-lang/markset.

MIT.