Skip to content

Commit a30a7f9

Browse files
committed
docs: add new faq docs (#1022)
1 parent f7e6064 commit a30a7f9

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

netlify.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
NPM_FLAGS = "--version" # prevent Netlify npm install
33
[build]
44
publish = "website/build"
5-
command = "npx pnpm i --store=node_modules/.pnpm-store && npx pnpm add -D ./website --store=node_modules/.pnpm-store && cd website && npx pnpm build"
5+
command = "npx pnpm i --store=node_modules/.pnpm-store && cd website && npx pnpm i --store=node_modules/.pnpm-store && npx pnpm build"

website/docs/faq/docs.js

+8
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@ exports.docs = [
1616
title: 'Why is a background fill not working?',
1717
slug: '/faq/fill-property',
1818
},
19+
{
20+
title: 'How to fix "... is not a registered element" error?',
21+
slug: '/faq/registered-element',
22+
},
23+
{
24+
title: 'How to fix "... is not a registered scale" error?',
25+
slug: '/faq/registered-scale',
26+
},
1927
];
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
slug: /faq/registered-element
3+
---
4+
5+
# How to fix "... is not a registered element" error?
6+
7+
As you can see in [migration to v4 guide](/docs/migration-to-v4#tree-shaking):
8+
9+
> v4 of this library, [just like Chart.js v3](https://www.chartjs.org/docs/latest/getting-started/v3-migration.html#setup-and-installation), is tree-shakable. It means that you need to import and register the controllers, elements, scales, and plugins you want to use.
10+
>
11+
> For a list of all the available items to import, see [Chart.js docs](https://www.chartjs.org/docs/latest/getting-started/integration.html#bundlers-webpack-rollup-etc).
12+
13+
So you should register missed components. For example, if you have `Uncaught Error: "arc" is not a registered element.` error, you should register `ArcElement`:
14+
15+
```js
16+
import { ArcElement } from "chart.js";
17+
18+
ChartJS.register(ArcElement);
19+
```

website/docs/faq/registered-scale.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
slug: /faq/registered-scale
3+
---
4+
5+
# How to fix "... is not a registered scale" error?
6+
7+
As you can see in [migration to v4 guide](/docs/migration-to-v4#tree-shaking):
8+
9+
> v4 of this library, [just like Chart.js v3](https://www.chartjs.org/docs/latest/getting-started/v3-migration.html#setup-and-installation), is tree-shakable. It means that you need to import and register the controllers, elements, scales, and plugins you want to use.
10+
>
11+
> For a list of all the available items to import, see [Chart.js docs](https://www.chartjs.org/docs/latest/getting-started/integration.html#bundlers-webpack-rollup-etc).
12+
13+
So you should register missed components. For example, if you have `Uncaught Error: "category" is not a registered scale.` error, you should register `CategoryScale`:
14+
15+
```js
16+
import { CategoryScale } from "chart.js";
17+
18+
ChartJS.register(CategoryScale);
19+
```

0 commit comments

Comments
 (0)