# chartjs-chart-matrix

> Chart.js module for creating matrix charts

Latest version **3.1.0** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install chartjs-chart-matrix
pnpm add chartjs-chart-matrix
yarn add chartjs-chart-matrix
bun add chartjs-chart-matrix
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2026-09-12 |
| First published | 2019-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 52 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Jukka Kurkela |
| Maintainers | kurkle |
| Keywords | chart.js, chart, matrix |

## Links

- npm: https://www.npmjs.com/package/chartjs-chart-matrix
- Repository: https://github.com/kurkle/chartjs-chart-matrix
- Homepage: https://chartjs-chart-matrix.pages.dev/
- Issues: https://github.com/kurkle/chartjs-chart-matrix/issues
- npm.io page: https://npm.io/package/chartjs-chart-matrix

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2026-09-12
- 1.0.0-rc (next) — 2021-03-21
- 3.0.8 — 2026-09-06
- 3.0.7 — 2026-09-05
- 3.0.6 — 2026-09-05
- 3.0.5 — 2026-07-05
- 3.0.4 — 2026-05-06
- 3.0.3 — 2026-05-06
- 3.0.2 — 2026-05-02
- 3.0.1 — 2026-05-02
- 3.0.0 — 2025-03-15
- 2.1.1 — 2025-03-15
- 2.1.0 — 2025-03-15
- 2.0.1 — 2023-01-24
- 2.0.0 — 2023-01-24
- … 19 more at https://npm.io/package/chartjs-chart-matrix/versions

## README

# chartjs-chart-matrix

[![npm](https://img.shields.io/npm/v/chartjs-chart-matrix.svg)](https://www.npmjs.com/package/chartjs-chart-matrix)
[![release](https://img.shields.io/github/release/kurkle/chartjs-chart-matrix.svg?style=flat-square)](https://github.com/kurkle/chartjs-chart-matrix/releases/latest)
![npm bundle size](https://img.shields.io/bundlephobia/min/chartjs-chart-matrix.svg)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kurkle_chartjs-chart-matrix&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=kurkle_chartjs-chart-matrix)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=kurkle_chartjs-chart-matrix&metric=coverage)](https://sonarcloud.io/summary/new_code?id=kurkle_chartjs-chart-matrix)
[![documentation](https://img.shields.io/static/v1?message=Documentation&color=informational)](https://chartjs-chart-matrix.pages.dev)
![GitHub](https://img.shields.io/github/license/kurkle/chartjs-chart-matrix.svg)

[Chart.js](https://www.chartjs.org/) **v3+, v4+** module that adds a matrix chart type, plotting data as a grid of colored, sized rectangles — useful for heatmaps, confusion matrices, calendars and other value-by-coordinate data, for anyone already charting with Chart.js.

## Example

![Matrix Example Image](matrix.png)

## Installation

### npm

```bash
> npm install chartjs-chart-matrix
```

### CDN

```html
<script src="https://cdn.jsdelivr.net/npm/chart.js@4"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-chart-matrix@3"></script>
```

## Quickstart

```html
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/chart.js@3.7"></script>
  <script src="https://cdn.jsdelivr.net/npm/chartjs-chart-matrix@1.1"></script>
</head>
<body>
  <div class="chart-container">
    <canvas id="matrix-chart">
  </div>
  <script>
    const chart = new Chart('matrix-chart', {
      type: 'matrix',
      data: {
        datasets: [{
          label: 'Basic matrix',
          data: [{x: 1, y: 1}, {x: 2, y: 1}, {x: 1, y: 2}, {x: 2, y: 2}],
          borderWidth: 1,
          borderColor: 'rgba(0,0,0,0.5)',
          backgroundColor: 'rgba(200,200,0,0.3)',
          width: ({chart}) => (chart.chartArea || {}).width / 2 - 1,
          height: ({chart}) => (chart.chartArea || {}).height / 2 - 1,
        }],
      },
      options: {
        scales: {
          x: {
            display: false,
            min: 0.5,
            max: 2.5,
            offset: false
          },
          y: {
            display: false,
            min: 0.5,
            max: 2.5
          }
        }
      }
    });
  </script>
</body>
```

This simple example is also available online in the documentation: https://chartjs-chart-matrix.pages.dev/usage/

## Documentation

You can find documentation for chartjs-chart-matrix at [https://chartjs-chart-matrix.pages.dev/](https://chartjs-chart-matrix.pages.dev/). The full configuration reference lives there, not in this README — this file stays a quickstart.

## Development

You first need to install node dependencies  (requires [Node.js](https://nodejs.org/)):

```bash
> npm install
```

The following commands will then be available from the repository root:

```bash
> npm run build        // build dist files
> npm test             // run all tests
> npm run lint         // perform code linting
> npm package          // create an archive with dist files and samples
```

## License

chartjs-chart-matrix is available under the [MIT license](https://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/chartjs-chart-matrix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
