mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Remove unreachable code paths from plugins (#8513)
This commit is contained in:
parent
65a601476c
commit
692d8a4128
@ -114,24 +114,18 @@ class simpleArc {
|
||||
pathSegment(ctx, bounds, opts) {
|
||||
const {x, y, radius} = this;
|
||||
bounds = bounds || {start: 0, end: TAU};
|
||||
if (opts.reverse) {
|
||||
ctx.arc(x, y, radius, bounds.end, bounds.start, true);
|
||||
} else {
|
||||
ctx.arc(x, y, radius, bounds.start, bounds.end);
|
||||
}
|
||||
ctx.arc(x, y, radius, bounds.end, bounds.start, true);
|
||||
return !opts.bounds;
|
||||
}
|
||||
|
||||
interpolate(point, property) {
|
||||
interpolate(point) {
|
||||
const {x, y, radius} = this;
|
||||
const angle = point.angle;
|
||||
if (property === 'angle') {
|
||||
return {
|
||||
x: x + Math.cos(angle) * radius,
|
||||
y: y + Math.sin(angle) * radius,
|
||||
angle
|
||||
};
|
||||
}
|
||||
return {
|
||||
x: x + Math.cos(angle) * radius,
|
||||
y: y + Math.sin(angle) * radius,
|
||||
angle
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,24 +119,6 @@ function createTitle(chart, titleOpts) {
|
||||
chart.titleBlock = title;
|
||||
}
|
||||
|
||||
function removeTitle(chart) {
|
||||
const title = chart.titleBlock;
|
||||
if (title) {
|
||||
layouts.removeBox(chart, title);
|
||||
delete chart.titleBlock;
|
||||
}
|
||||
}
|
||||
|
||||
function createOrUpdateTitle(chart, options) {
|
||||
const title = chart.titleBlock;
|
||||
if (title) {
|
||||
layouts.configure(chart, title, options);
|
||||
title.options = options;
|
||||
} else {
|
||||
createTitle(chart, options);
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
id: 'title',
|
||||
|
||||
@ -157,11 +139,9 @@ export default {
|
||||
},
|
||||
|
||||
beforeUpdate(chart, _args, options) {
|
||||
if (options === false) {
|
||||
removeTitle(chart);
|
||||
} else {
|
||||
createOrUpdateTitle(chart, options);
|
||||
}
|
||||
const title = chart.titleBlock;
|
||||
layouts.configure(chart, title, options);
|
||||
title.options = options;
|
||||
},
|
||||
|
||||
defaults: {
|
||||
|
Loading…
Reference in New Issue
Block a user