2022-08-03 02:32:02 +02:00
# 4.x Migration Guide
2022-10-07 15:56:07 +02:00
Chart.js 4.0 introduces a number of breaking changes. We tried keeping the amount of breaking changes to a minimum. For some features and bug fixes it was necessary to break backwards compatibility, but we aimed to do so only when worth the benefit.
2022-08-03 02:32:02 +02:00
## End user migration
2022-08-18 13:34:35 +02:00
### Charts
* Charts don't override the default tooltip callbacks, so all chart types have the same-looking tooltips.
2022-09-02 06:52:48 +02:00
* Default scale override has been removed if the configured scale starts with `x` /`y`. Defining `xAxes` in your config will now create a second scale instead of overriding the default `x` axis.
2022-08-18 13:34:35 +02:00
2022-08-03 02:32:02 +02:00
### Options
A number of changes were made to the configuration options passed to the `Chart` constructor. Those changes are documented below.
#### Specific changes
* The radialLinear grid indexable and scriptable options don't decrease the index of the specified grid line anymore.
2022-08-05 18:51:14 +02:00
* The `destroy` plugin hook has been removed and replaced with `afterDestroy` .
2022-08-05 13:59:36 +02:00
* Ticks callback on time scale now receives timestamp instead of a formatted label.
2022-08-18 15:07:46 +02:00
* `scales[id].grid.drawBorder` has been renamed to `scales[id].border.display` .
* `scales[id].grid.borderWidth` has been renamed to `scales[id].border.width` .
* `scales[id].grid.borderColor` has been renamed to `scales[id].border.color` .
* `scales[id].grid.borderDash` has been renamed to `scales[id].border.dash` .
* `scales[id].grid.borderDashOffset` has been renamed to `scales[id].border.dashOffset` .
* The z index for the border of a scale is now configurable instead of being 1 higher as the grid z index.
2022-08-18 13:33:15 +02:00
* Linear scales now add and subtracts `5%` of the max value to the range if the min and max are the same instead of `1` .
2022-08-18 08:03:12 +02:00
* If the tooltip callback returns `undefined` , then the default callback will be used.
2022-09-02 14:03:41 +02:00
* `maintainAspectRatio` respects container height.
2022-09-10 17:46:26 +02:00
* Time and timeseries scales use `ticks.stepSize` instead of `time.stepSize` , which has been removed.
2022-09-13 19:33:22 +02:00
* `maxTickslimit` wont be used for the ticks in `autoSkip` if the determined max ticks is less then the `maxTicksLimit` .
2022-11-18 18:39:58 +01:00
* `dist/chart.js` has been removed.
* `dist/chart.min.js` has been renamed to `dist/chart.umd.js` .
* `dist/chart.esm.js` has been renamed to `dist/chart.js` .
2022-08-04 01:06:15 +02:00
#### Type changes
2022-08-18 13:34:18 +02:00
* The order of the `ChartMeta` parameters have been changed from `<Element, DatasetElement, Type>` to `<Type, Element, DatasetElement>` .
### General
* Removed fallback to `fontColor` for the legend text and strikethrough color.
2022-08-22 21:17:40 +02:00
* Removed `config._chart` fallback for `this.chart` in the filler plugin.
* Removed `this._chart` in the filler plugin.