Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/guide/migrationV2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions src/helpers/helpers.canvas.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/types/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/types/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
5 changes: 0 additions & 5 deletions types/label.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ export interface ContainedLabelOptions extends CoreLabelOptions {
* @default 6
*/
borderRadius?: Scriptable<number | BorderRadius, PartialEventContext>,
/**
* @deprecated replaced by borderRadius
* @todo remove at v2
*/
cornerRadius?: Scriptable<number | BorderRadius, PartialEventContext>,
}

export interface LabelOptions extends ContainedLabelOptions, ShadowOptions {
Expand Down
5 changes: 0 additions & 5 deletions types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ export interface BoxAnnotationOptions extends CoreAnnotationOptions, AnnotationC
*/
borderJoinStyle?: Scriptable<CanvasLineJoin, PartialEventContext>,
borderRadius?: Scriptable<number | BorderRadius, PartialEventContext>,
/**
* @deprecated replaced by borderRadius
* @todo remove at v2
*/
cornerRadius?: Scriptable<number, PartialEventContext>,
label?: BoxLabelOptions,
rotation?: Scriptable<number, PartialEventContext>
}
Expand Down