From 46fb57a07a7c536af35498a35fc971aae103c047 Mon Sep 17 00:00:00 2001 From: dangreen Date: Mon, 21 Feb 2022 15:04:41 +0700 Subject: [PATCH] docs: add new faq docs --- website/docs/faq/docs.js | 8 ++++++++ website/docs/faq/registered-element.md | 19 +++++++++++++++++++ website/docs/faq/registered-scale.md | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 website/docs/faq/registered-element.md create mode 100644 website/docs/faq/registered-scale.md diff --git a/website/docs/faq/docs.js b/website/docs/faq/docs.js index a57cdac73..c5b9eeca6 100644 --- a/website/docs/faq/docs.js +++ b/website/docs/faq/docs.js @@ -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', + }, ]; diff --git a/website/docs/faq/registered-element.md b/website/docs/faq/registered-element.md new file mode 100644 index 000000000..dabc538cc --- /dev/null +++ b/website/docs/faq/registered-element.md @@ -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); +``` diff --git a/website/docs/faq/registered-scale.md b/website/docs/faq/registered-scale.md new file mode 100644 index 000000000..453af3c4d --- /dev/null +++ b/website/docs/faq/registered-scale.md @@ -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); +```