|
1 |
| -# Migration to v4 |
| 1 | +## Migration from v3 to v4 |
2 | 2 |
|
3 | 3 | With v4, this library introduces a number of breaking changes. In order to improve performance, offer new features, and improve maintainability, it was necessary to break backwards compatibility, but we aimed to do so only when worth the benefit.
|
4 | 4 |
|
5 | 5 | v4 is fully compatible with Chart.js v3.
|
6 | 6 |
|
7 |
| -## Tree-shaking |
| 7 | +### Tree-shaking |
8 | 8 |
|
9 | 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 | 10 |
|
@@ -43,7 +43,7 @@ import { Chart as ChartJS, Title, Tooltip, Legend, ArcElement, CategoryScale } f
|
43 | 43 | ChartJS.register(Title, Tooltip, Legend, ArcElement, CategoryScale)
|
44 | 44 | ```
|
45 | 45 |
|
46 |
| -## Changing the creation of Charts |
| 46 | +### Changing the creation of Charts |
47 | 47 |
|
48 | 48 | In v3, you needed to import the component, and then either use extends or mixins and add it.
|
49 | 49 |
|
@@ -121,7 +121,7 @@ export default {
|
121 | 121 | </script>
|
122 | 122 | ```
|
123 | 123 |
|
124 |
| -## New reactivity system |
| 124 | +### New reactivity system |
125 | 125 |
|
126 | 126 | v3 does not update or re-render the chart if new data is passed. You needed to use `reactiveProp` and `reactiveData` mixins for that.
|
127 | 127 |
|
@@ -165,3 +165,54 @@ export default {
|
165 | 165 | }
|
166 | 166 | </script>
|
167 | 167 | ```
|
| 168 | + |
| 169 | +## Migration from vue-chart-3 |
| 170 | + |
| 171 | +### Uninstall vue-chart-3 |
| 172 | + |
| 173 | +```bash |
| 174 | +pnpm rm vue-chart-3 |
| 175 | +# or |
| 176 | +yarn remove vue-chart-3 |
| 177 | +# or |
| 178 | +npm uninstall vue-chart-3 |
| 179 | +``` |
| 180 | + |
| 181 | +### Install vue-chartjs |
| 182 | + |
| 183 | +```bash |
| 184 | +pnpm add vue-chartjs |
| 185 | +# or |
| 186 | +yarn add vue-chartjs |
| 187 | +# or |
| 188 | +npm i vue-chartjs |
| 189 | +``` |
| 190 | + |
| 191 | +### Change component import path |
| 192 | + |
| 193 | +For Vue 3 projects: |
| 194 | + |
| 195 | +```javascript |
| 196 | +import { /* component */ } from 'vue-chartjs' |
| 197 | +``` |
| 198 | + |
| 199 | +For Vue 2 projects: |
| 200 | + |
| 201 | +```javascript |
| 202 | +import { /* component */ } from 'vue-chartjs/legacy' |
| 203 | +``` |
| 204 | + |
| 205 | +### Rename components |
| 206 | + |
| 207 | +- BarChart to Bar |
| 208 | +- DoughnutChart to Doughnut |
| 209 | +- LineChart to Line |
| 210 | +- PieChart to Pie |
| 211 | +- PolarAreaChart to PolarArea |
| 212 | +- RadarChart to Radar |
| 213 | +- BubbleChart to Bubble |
| 214 | +- ScatterChart to Scatter |
| 215 | + |
| 216 | +### Rename props |
| 217 | + |
| 218 | +- options to chartOptions |
0 commit comments