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

@kuzanatoliorg/chartjs-tooltip-pronunciation-plugin

v1.0.0

Published

Chartjs tooltip pronunciation plugin

Readme

chartjs-tooltip-pronunciation-plugin

npm version npm downloads License

GitHub stars GitHub issues

An accessibility-focused Chart.js plugin that bridges the gap for screen reader users by automatically pronouncing tooltip content. Since native Chart.js tooltips are drawn purely visually on the <canvas> element, they are completely invisible to screen readers (like NVDA, VoiceOver, JAWS). This plugin fixes that by dynamically injecting the active tooltip's data into a visually hidden ARIA live region (role="status"), ensuring the data is seamlessly read aloud to assistive technology users and helping your dashboards achieve WCAG compliance.

🚀 Try the Interactive Demo | 📺 Watch the Video Walkthrough

Table of Contents


Features

  • ♿ a11y Compliant: Empowers screen reader users to understand interactive chart data and aids in WCAG 2.1 / ADA compliance.
  • 🗣️ Seamless Pronunciation: Automatically updates an ARIA live region when the active tooltip changes.
  • ⚙️ Fully Customizable: Exposes a simple pronunciationFormatter function to precisely format the spoken string, ensuring perfect localization and semantic meaning.
  • 📦 Framework Agnostic: Works smoothly with Vanilla JS or React wrapper frameworks.

Installation

npm

npm install @kuzanatoliorg/chartjs-tooltip-pronunciation-plugin

yarn

yarn add @kuzanatoliorg/chartjs-tooltip-pronunciation-plugin

pnpm

pnpm add @kuzanatoliorg/chartjs-tooltip-pronunciation-plugin

Getting Started

To enable screen reader support for tooltips, you need to register the plugin with Chart.js and provide a pronunciationFormatter configuration option.

Vanilla Chart.js Execution

Register the plugin globally or per chart instance:

import Chart from 'chart.js/auto';
import { chartjsTooltipPronunciationPlugin } from '@kuzanatoliorg/chartjs-tooltip-pronunciation-plugin';

const chart = new Chart(ctx, {
    type: 'bar',
    data: chartData,
    options: {
        plugins: {
            chartjsTooltipPronunciationPlugin: {
                // REQUIRED: Construct the text to be announced by the screen reader.
                // (`tooltipItems` is an array of standard Chart.js TooltipItem objects)
                pronunciationFormatter: (tooltipItems) => {
                    return tooltipItems
                        .map(item => `${item.dataset.label}: ${item.formattedValue}`)
                        .join(', ');
                }
            }
        }
    },
    plugins: [chartjsTooltipPronunciationPlugin]
});

React Framework Integration (react-chartjs-2)

For React applications using react-chartjs-2, you can pass the plugin in the plugins array and provide the formatter in options:

import { Bar } from 'react-chartjs-2';
import { chartjsTooltipPronunciationPlugin } from '@kuzanatoliorg/chartjs-tooltip-pronunciation-plugin';

function MyChart() {
  const options = {
    plugins: {
      chartjsTooltipPronunciationPlugin: {
        pronunciationFormatter: (tooltipItems) => {
          return tooltipItems
            .map(item => `${item.dataset.label}: ${item.formattedValue}`)
            .join(', ');
        }
      }
    }
  };

  return (
    <Bar
      data={data}
      options={options}
      plugins={[chartjsTooltipPronunciationPlugin]}
    />
  );
}

Configuration Options

Fine-tune how the tooltip is pronounced via the main chartjsTooltipPronunciationPlugin configuration envelope:

const chart = new Chart(ctx, {
    options: {
        plugins: {
            chartjsTooltipPronunciationPlugin: {
                /**
                 * (Required) Function that takes the active Chart.js TooltipItems and
                 * returns a string to be pronounced by the screen reader.
                 * (`tooltipItems` is an array of standard Chart.js TooltipItem objects)
                 *
                 * By default, a console warning is emitted if this is not provided.
                 */
                pronunciationFormatter: (tooltipItems) => {
                    // Example formatting: "Sales: $500, Expenses: $300"
                    return tooltipItems
                        .map(item => `${item.dataset.label}: ${item.formattedValue}`)
                        .join(', ');
                }
            },
        }
    }
});

TypeScript Definitions

Extend your environment types smoothly if you're using TypeScript. Place a global.d.ts file within your source directory structure:

import { ChartType } from 'chart.js';
import { type TChartjsTooltipPronunciationPluginOptions } from '@kuzanatoliorg/chartjs-tooltip-pronunciation-plugin';

declare module 'chart.js' {
  interface PluginOptionsByType<TType extends ChartType> {
    chartjsTooltipPronunciationPlugin?: TChartjsTooltipPronunciationPluginOptions;
  }
}