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

@tooark/chart

v1.3.0

Published

Tooark Chart — Custom Element <ark-chart> based on ECharts, following the page's light/dark theme

Readme

@tooark/chart

npm License

<ark-chart>: an ECharts chart as a Custom Element that follows the page's light/dark theme, with auto-resize and a click event — plus the imperative engine for use without the element.

🌍 Languages: USA Flag English (this file) · Brazil Flag Português


Contents


📖 Overview

The @tooark/chart package provides:

  • ark-chart with the native ECharts option as a JS property, theme (auto follows the page's color-scheme, including runtime toggles), renderer (canvas/svg), height and auto-resize;
  • ark-chart-click (bubbles, composed) with the native ECharts params as detail;
  • createChart(container, options) engine: setOption, setTheme, resize, resolvedTheme, destroy and the raw chart instance;
  • ECharts is a peer dependency: you pick the version (the engine imports the whole echarts package, so it is not tree-shaken).

🔧 Installation

pnpm add @tooark/chart echarts   # echarts is a peer dependency (>= 5)

⚙️ Configuration

Register the element once (browser only); the chart draws its own colors with ECharts' default (light) or built-in dark theme, not the --ark-color-* tokens, so no stylesheet is required — the theme follows the page's color-scheme or the element's theme attribute:

import { registerTooarkChart } from "@tooark/chart";

registerTooarkChart();

In React, Vue or Angular use the tag directly (the framework READMEs show how); a JS property the framework assigns before this call, such as option bound on the tag, is applied when the element upgrades, so the order does not matter.


📦 Components

ark-chart

  • Attributes: theme (auto | light | dark, default auto), renderer (canvas | svg), height (CSS length, default 320px), auto-resize ("false" turns it off), testid, aria-label/aria-labelledby (the host becomes role="img" with that name, unless you gave it a role; without them nothing changes, and ECharts' generated description, option.aria, stays available).
  • Properties: option (the EChartsOption; assigning re-renders with notMerge), resolvedTheme.
  • Events: ark-chart-click with the ECharts params in detail.
  • Hooks: the chart container ([part="canvas"]) carries data-ark="chart" and the testid as data-testid.

Engine

  • createChart(container, { option, theme?, renderer?, autoResize? }) → { chart, setOption(option, { notMerge }), setTheme(theme), resize(), resolvedTheme(), destroy() }; autoResize (default true) resizes the chart with the container.
  • resolveChartTheme(theme, element).
  • Types: ArkChartOptions, ArkChartTheme, ArkChartRenderer, ArkChartInstance, EChartsOption (re-exported).

📝 Usage examples

A bar chart that follows the page theme

const chart = document.createElement("ark-chart");
chart.setAttribute("height", "320px");
chart.option = {
  xAxis: { type: "category", data: ["Mon", "Tue", "Wed"] },
  yAxis: { type: "value" },
  series: [{ type: "bar", data: [120, 200, 150] }],
};
chart.addEventListener("ark-chart-click", (event) => {
  console.log((event as CustomEvent).detail.name, (event as CustomEvent).detail.value);
});
document.body.appendChild(chart);

The engine without the element

import { createChart } from "@tooark/chart";

const instance = createChart(document.querySelector("#sales")!, { option, theme: "auto" });
instance.setOption(nextOption, { notMerge: true });
instance.chart.on("legendselectchanged", handler); // raw ECharts API
instance.destroy();

📋 Dependencies

Installed automatically unless marked as peer; peer dependencies are yours to install (the ranges are what the package declares).

| Package | Version | Description | | ---------------------------------------------------------------- | ---------- | --------------------------------------------------------- | | @tooark/tokens | ^1.3.0 | Design tokens (colors, sizes, motion) and primitive types | | tslib | ^2.8.1 | TypeScript runtime helpers | | echarts | >=5 (peer) | Chart engine |


🪪 Contributing

Contributions are welcome! Open issues and pull requests in the Tooark/web-components repository; CONTRIBUTING.md covers the workflow, the commit convention and the checklist. @tooark/chart is released in lockstep with every other @tooark/* package.


📄 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.