diff --git a/docs/guide/migrationV2.md b/docs/guide/migrationV2.md index eeaae0fba..ba293fc8c 100644 --- a/docs/guide/migrationV2.md +++ b/docs/guide/migrationV2.md @@ -8,7 +8,8 @@ A number of changes were made to the configuration options passed to the plugin * `xScaleID` option default has been changed, now set to `undefined`. If the option is missing, the plugin will try to use the first scale of the chart, configured as `'x'` axis. If more than one scale has been defined in the chart as `'x'` axis, the option is mandatory to select the right scale. * `yScaleID` option default has been changed, now set to `undefined`. If the option is missing, the plugin will try to use the first scale of the chart, configured as `'y'` axis. If more than one scale has been defined in the chart as `'y'` axis, the option is mandatory to select the right scale. -* When [stacked scales](https://www.chartjs.org/docs/latest/axes/cartesian/#common-options-to-all-cartesian-axes) are used, instead of the whole chart area, the designated scale area is used as fallback for `xMin`, `xMax`, `yMin`, `yMax`, `xValue` or `yValue` options. + * When [stacked scales](https://www.chartjs.org/docs/latest/axes/cartesian/#common-options-to-all-cartesian-axes) are used, instead of the whole chart area, the designated scale area is used as fallback for `xMin`, `xMax`, `yMin`, `yMax`, `xValue` or `yValue` options. + * `cornerRadius` option was replaced by `borderRadius` in the box annotation configuration and in the label configuration of line annotation to align with Chart.js options. ## Events diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index 2a150a2d5..289fc236e 100644 --- a/src/helpers/helpers.canvas.js +++ b/src/helpers/helpers.canvas.js @@ -1,4 +1,4 @@ -import {addRoundedRectPath, isArray, toFont, toTRBLCorners, valueOrDefault, toRadians} from 'chart.js/helpers'; +import {addRoundedRectPath, isArray, toFont, toTRBLCorners, toRadians} from 'chart.js/helpers'; import {clampAll} from './helpers.core'; import {calculateTextAlignment, getSize} from './helpers.options'; @@ -112,8 +112,7 @@ export function drawBox(ctx, rect, options) { ctx.beginPath(); addRoundedRectPath(ctx, { x, y, w: width, h: height, - // TODO: v2 remove support for cornerRadius - radius: clampAll(toTRBLCorners(valueOrDefault(options.cornerRadius, options.borderRadius)), 0, Math.min(width, height) / 2) + radius: clampAll(toTRBLCorners(options.borderRadius), 0, Math.min(width, height) / 2) }); ctx.closePath(); ctx.fill(); diff --git a/src/types/box.js b/src/types/box.js index 1b26b6f4f..aeea28257 100644 --- a/src/types/box.js +++ b/src/types/box.js @@ -61,7 +61,6 @@ BoxAnnotation.defaults = { borderRadius: 0, borderShadowColor: 'transparent', borderWidth: 1, - cornerRadius: undefined, // TODO: v2 remove support for cornerRadius display: true, label: { borderWidth: undefined, diff --git a/src/types/line.js b/src/types/line.js index 0f176a259..bdd5b0319 100644 --- a/src/types/line.js +++ b/src/types/line.js @@ -260,7 +260,6 @@ LineAnnotation.defaults = { borderWidth: 0, color: '#fff', content: null, - cornerRadius: undefined, // TODO: v2 remove support for cornerRadius drawTime: undefined, enabled: false, font: { diff --git a/types/label.d.ts b/types/label.d.ts index 67fa5669e..336e60ee0 100644 --- a/types/label.d.ts +++ b/types/label.d.ts @@ -77,11 +77,6 @@ export interface ContainedLabelOptions extends CoreLabelOptions { * @default 6 */ borderRadius?: Scriptable, - /** - * @deprecated replaced by borderRadius - * @todo remove at v2 - */ - cornerRadius?: Scriptable, } export interface LabelOptions extends ContainedLabelOptions, ShadowOptions { diff --git a/types/options.d.ts b/types/options.d.ts index 68d8a373d..5a7d0078a 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -102,11 +102,6 @@ export interface BoxAnnotationOptions extends CoreAnnotationOptions, AnnotationC */ borderJoinStyle?: Scriptable, borderRadius?: Scriptable, - /** - * @deprecated replaced by borderRadius - * @todo remove at v2 - */ - cornerRadius?: Scriptable, label?: BoxLabelOptions, rotation?: Scriptable }