chartjs-plugin-a11y

0.1.3 • Public • Published

chartjs-plugin-a11y.js

An accessibility plugin for Chart.js.

⚠️ WARNING This is an early release so may not work for all use cases.

We've done our best at adding as many accessibility features as possible with minimal impact to the core functionality of Chart.js. Whilst this plugin adds improvements chart accessibility programmatically, there are areas such as styles that will still need to be considered when improving the accessibility of your charts.

Always refer to the WCAG guidelines when determining whether an application meets the required accessibility standards for your use case.

Accessibility features this plugin provides:

  • Keyboard navigation
  • Screen reader announcements

Not provided (you'll need to consider these yourself):

  • Enforced colors and color combinations
  • Enforced font sizes

Installation

Make sure you already have Chart.js installed.

To install the plugin via npm:

npm install chartjs-plugin-a11y --save

Usage

Import the plugin using ES6 modules syntax:

import ChartjsPluginA11y from 'chartjs-plugin-a11y';

To register the plugin globally for use in all of your charts you can use the Chart.js register method:

Chart.register({ChartjsPluginA11y});

Alternatively you can use this plugin with a specific chart:

var chart = new Chart(ctx, {
  plugins: [ChartjsPluginA11y],
});

options

Plugin options can be set like so:

var chart = new Chart(ctx, {
  plugins: [ChartjsPluginA11y],
  options: {
    plugins: {
      chartjsPluginA11y: {
        // ...
      }
    }
  },

The table below shows available configuration options.

Name Type Default Description
chartLabel string 'chart.type chart' sets canvas element aria-label

Demo

For examples of usage, see the demo files included within this repository.

Running

Install dependencies:

npm install

Build production package:

npm run build

License

chartjs-plugin-a11y is available under the MIT license.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.31latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.31
0.1.20
0.1.10
0.1.00

Package Sidebar

Install

npm i chartjs-plugin-a11y

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

89.8 kB

Total Files

9

Last publish

Collaborators

  • jackcranston