### Install via npm
Source: https://chartjs-chart-matrix.pages.dev/
Use this command to install the chartjs-chart-matrix package using npm.
```bash
npm install chartjs-chart-matrix
```
--------------------------------
### Include via Script Tag
Source: https://chartjs-chart-matrix.pages.dev/integration
Include Chart.js and the matrix plugin using CDN links in your HTML. Then, initialize a new Chart instance with type 'matrix'.
```html
```
--------------------------------
### Include via CDN
Source: https://chartjs-chart-matrix.pages.dev/
Link to the latest minified version or a specific version of the chartjs-chart-matrix extension using jsDelivr.
```html
https://cdn.jsdelivr.net/npm/chartjs-chart-matrix@2.0.1
```
```html
https://cdn.jsdelivr.net/npm/chartjs-chart-matrix@2
```
--------------------------------
### Basic Matrix Chart Configuration
Source: https://chartjs-chart-matrix.pages.dev/usage
This snippet shows how to configure a basic matrix chart using the chartjs-chart-matrix plugin. It defines the chart type, data structure, and scale options.
```javascript
const config = {
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 },
},
},
}
```
--------------------------------
### Register with Bundlers
Source: https://chartjs-chart-matrix.pages.dev/integration
Import Chart.js and the necessary components from chartjs-chart-matrix when using module bundlers. Register the controller and element with Chart.js.
```javascript
import { Chart } from 'chart.js'
import { MatrixController, MatrixElement } from 'chartjs-chart-matrix'
Chart.register(MatrixController, MatrixElement)
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.