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
+ };
}
}
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',
},
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: {