Skip to content

Commit

Permalink
docs: add new faq docs (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Feb 21, 2022
1 parent f7e6064 commit a30a7f9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
NPM_FLAGS = "--version" # prevent Netlify npm install
[build]
publish = "website/build"
command = "npx pnpm i --store=node_modules/.pnpm-store && npx pnpm add -D ./website --store=node_modules/.pnpm-store && cd website && npx pnpm build"
command = "npx pnpm i --store=node_modules/.pnpm-store && cd website && npx pnpm i --store=node_modules/.pnpm-store && npx pnpm build"
8 changes: 8 additions & 0 deletions website/docs/faq/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ exports.docs = [
title: 'Why is a background fill not working?',
slug: '/faq/fill-property',
},
{
title: 'How to fix "... is not a registered element" error?',
slug: '/faq/registered-element',
},
{
title: 'How to fix "... is not a registered scale" error?',
slug: '/faq/registered-scale',
},
];
19 changes: 19 additions & 0 deletions website/docs/faq/registered-element.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
slug: /faq/registered-element
---

# How to fix "... is not a registered element" error?

As you can see in [migration to v4 guide](/docs/migration-to-v4#tree-shaking):

> 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.
>
> 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).
So you should register missed components. For example, if you have `Uncaught Error: "arc" is not a registered element.` error, you should register `ArcElement`:

```js
import { ArcElement } from "chart.js";

ChartJS.register(ArcElement);
```
19 changes: 19 additions & 0 deletions website/docs/faq/registered-scale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
slug: /faq/registered-scale
---

# How to fix "... is not a registered scale" error?

As you can see in [migration to v4 guide](/docs/migration-to-v4#tree-shaking):

> 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.
>
> 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).
So you should register missed components. For example, if you have `Uncaught Error: "category" is not a registered scale.` error, you should register `CategoryScale`:

```js
import { CategoryScale } from "chart.js";

ChartJS.register(CategoryScale);
```

0 comments on commit a30a7f9

Please sign in to comment.