-
Notifications
You must be signed in to change notification settings - Fork 373
Closed
Description
Currently label annotation is taking care also of the point drawing, the point selected with coordinates calculated by x/yVaue.
To simplify the label annotation, reducing duplication of similar code and options, the point node could be removed.
If a user wants to draw the selected point, could add another annotation, a point one, with the same x/yVaue.
This is also enabling a common approach if a user wants to draw a polygon instead of a point.
As is now:
const labelAndPoint = {
type: 'label',
backgroundColor: 'rgba(245,245,245, 0.5)',
content: (ctx) => 'Maximum value is ' + maxValue(ctx).toFixed(2),
point: {
enabled: true,
backgroundColor: 'transparent',
borderColor: (ctx) => ctx.chart.data.datasets[0].borderColor,
pointStyle: 'rectRounded',
radius: 10
},
xValue: 0,
yValue: 0
};As to be:
const label = {
type: 'label',
backgroundColor: 'rgba(245,245,245, 0.5)',
content: (ctx) => 'Maximum value is ' + maxValue(ctx).toFixed(2),
xValue: 0,
yValue: 0
};
const point = {
type: 'point',
backgroundColor: 'transparent',
borderColor: (ctx) => ctx.chart.data.datasets[0].borderColor,
pointStyle: 'rectRounded',
radius: 10,
xValue: 0,
yValue: 0
};This shouldn't be a breaking change because label annotation is not releases yet in any version.
@kurkle what do you think?
Metadata
Metadata
Assignees
Labels
No labels