Skip to content

Commit ef1fe41

Browse files
authored
docs: add info about major update (#1114)
1 parent 0f93ce8 commit ef1fe41

File tree

6 files changed

+89
-6
lines changed

6 files changed

+89
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
React components for <a href="https://www.chartjs.org">Chart.js</a>, the most popular charting library.
66

7-
Supports Chart.js v3 and v2.
7+
Supports Chart.js v4 and v3.
88

99
[![NPM version][npm]][npm-url]
1010
[![Downloads][downloads]][downloads-url]
@@ -50,7 +50,7 @@ yarn add react-chartjs-2 chart.js
5050
npm i react-chartjs-2 chart.js
5151
```
5252

53-
We recommend using `chart.js@^3.0.0`.
53+
We recommend using `chart.js@^4.0.0`.
5454

5555
Then, import and use individual components:
5656

website/docs/chartjs-v2.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ First, upgrade packages. You'll need to install Chart.js v3 and the latest versi
4444
<TabItem value="yarn" default>
4545

4646
```bash
47-
yarn add chart.js@^3.6.0 react-chartjs-2@latest
47+
yarn add chart.js@^3.6.0 react-chartjs-2@^4.0.0
4848
```
4949

5050
</TabItem>
5151
<TabItem value="pnpm">
5252

5353
```bash
54-
pnpm add chart.js@^3.6.0 react-chartjs-2@latest
54+
pnpm add chart.js@^3.6.0 react-chartjs-2@^4.0.0
5555
```
5656

5757
</TabItem>
5858
<TabItem value="npm">
5959

6060
```bash
61-
npm install --save chart.js@^3.6.0 react-chartjs-2@latest
61+
npm install --save chart.js@^3.6.0 react-chartjs-2@^4.0.0
6262
```
6363

6464
</TabItem>

website/docs/chartjs-v3.mdx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
slug: /docs/chartjs-v3
3+
description: Using react-chartjs-2 with Chart.js v3
4+
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
# Using with Chart.js v3
10+
11+
If your app needs [Chart.js v3](https://www.chartjs.org/docs/3.9.1/), please use a [compatible version](https://www.npmjs.com/package/react-chartjs-2/v/4.3.1) of this library:
12+
13+
<Tabs>
14+
<TabItem value="yarn" default>
15+
16+
```bash
17+
yarn add chart.js@^3.9.1 react-chartjs-2@^4.3.1
18+
```
19+
20+
</TabItem>
21+
<TabItem value="pnpm">
22+
23+
```bash
24+
pnpm add chart.js@^3.9.1 react-chartjs-2@^4.3.1
25+
```
26+
27+
</TabItem>
28+
<TabItem value="npm">
29+
30+
```bash
31+
npm install --save chart.js@^3.9.1 react-chartjs-2@^4.3.1
32+
```
33+
34+
</TabItem>
35+
</Tabs>
36+
37+
Also, please consider upgrading your app to [Chart.js v3](#upgrading-to-chartjs-v3).
38+
39+
## Upgrading to Chart.js v4
40+
41+
First, upgrade packages. You'll need to install Chart.js v3 and the latest version of this library:
42+
43+
<Tabs>
44+
<TabItem value="yarn" default>
45+
46+
```bash
47+
yarn add chart.js@^4.0.0 react-chartjs-2@^5.0.0
48+
```
49+
50+
</TabItem>
51+
<TabItem value="pnpm">
52+
53+
```bash
54+
pnpm add chart.js@^4.0.0 react-chartjs-2@^5.0.0
55+
```
56+
57+
</TabItem>
58+
<TabItem value="npm">
59+
60+
```bash
61+
npm install --save chart.js@^4.0.0 react-chartjs-2@^5.0.0
62+
```
63+
64+
</TabItem>
65+
</Tabs>
66+
67+
Then, please follow the [this guide](/docs/migration-to-v5).

website/docs/docs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
exports.docs = [
2+
{ title: 'Migration to v5', slug: '/docs/migration-to-v5' },
23
{ title: 'Migration to v4', slug: '/docs/migration-to-v4' },
34
{ title: 'Working with datasets', slug: '/docs/working-with-datasets' },
45
{ title: 'Working with events', slug: '/docs/working-with-events' },
6+
{ title: 'Using with Chart.js v3', slug: '/docs/chartjs-v3' },
57
{ title: 'Using with Chart.js v2', slug: '/docs/chartjs-v2' },
68
];

website/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Logo from '@site/static/img/logo.svg';
1313

1414
React components for [Chart.js](https://www.chartjs.org), the most popular charting library.
1515

16-
Supports Chart.js v3 (read below) and Chart.js v2 (see [this guide](/docs/chartjs-v2)).
16+
Supports Chart.js v4 (read below) and Chart.js v3 (see [this guide](/docs/chartjs-v3)).
1717

1818
[![NPM version][npm]][npm-url]
1919
[![Downloads][downloads]][downloads-url]

website/docs/migration-to-v5.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
slug: /docs/migration-to-v5
3+
description: react-chartjs-2 migration guide to v5
4+
---
5+
6+
# Migration to v5
7+
8+
Chart.js v4 and react-chartjs-2 v5 are [ESM-only packages](https://nodejs.org/api/esm.html). To use them in your project, it also should be ESM:
9+
10+
```json title="package.json"
11+
{
12+
"type": "module"
13+
}
14+
```

0 commit comments

Comments
 (0)