From 72f4f824ccfa85f8cddec8169aeba6d7d9bfcec2 Mon Sep 17 00:00:00 2001 From: stockiNail Date: Mon, 28 Feb 2022 10:56:18 +0100 Subject: [PATCH 1/4] Remove cornerRadius option from box and line annotations --- src/helpers/helpers.canvas.js | 3 +-- src/types/box.js | 1 - src/types/line.js | 1 - types/label.d.ts | 5 ----- types/options.d.ts | 5 ----- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index 2a150a2d5..2ac2a3901 100644 --- a/src/helpers/helpers.canvas.js +++ b/src/helpers/helpers.canvas.js @@ -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 a8649f570..360406d3a 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 9759cbc08..1cc427a3a 100644 --- a/src/types/line.js +++ b/src/types/line.js @@ -250,7 +250,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 b0d8d49e2..66c726c87 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 } From 0b9e01f44880e51b63882b3f73e46ecff6510c33 Mon Sep 17 00:00:00 2001 From: stockiNail Date: Mon, 28 Feb 2022 11:14:05 +0100 Subject: [PATCH 2/4] removes useless import --- src/helpers/helpers.canvas.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index 2ac2a3901..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'; From 60f520b40c1ca4b1306b02b9ad24bc5fb827e81f Mon Sep 17 00:00:00 2001 From: stockiNail Date: Mon, 4 Apr 2022 21:59:54 +0200 Subject: [PATCH 3/4] adds note about breaking change in the migration guide --- docs/guide/migrationV2.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/guide/migrationV2.md b/docs/guide/migrationV2.md index eeaae0fba..a2c5692f9 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. ## Events From f1331d34cf6ce6c2790b4cb33b0ef5125687f5b5 Mon Sep 17 00:00:00 2001 From: stockiNail Date: Mon, 4 Apr 2022 22:27:40 +0200 Subject: [PATCH 4/4] add reason of breaking change --- docs/guide/migrationV2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/migrationV2.md b/docs/guide/migrationV2.md index a2c5692f9..ba293fc8c 100644 --- a/docs/guide/migrationV2.md +++ b/docs/guide/migrationV2.md @@ -9,7 +9,7 @@ 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. - * `cornerRadius` option was replaced by `borderRadius` in the box annotation configuration and in the label configuration of line annotation. + * `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