Skip to content

docs: add new faq docs #1022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
```