label annotation not showing
EmanuelOcampo opened this issue · comments
const options = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: "bottom" as const,
},
annotation: {
annotations: {
point1: {
type: 'point',
x: lineChartData?.maxSolar?.ts,
y: lineChartData?.maxSolar?.m_s,
backgroundColor: 'rgba(0, 255, 8, 0.25)'
}
}
}
},
scales: {
y: {
ticks: {
font: {
size: 14,
},
callback: function(value: any) {
return value + ' kWh';
}
},
stacked: true,
},
x:{
ticks: {
font: {
size: 14,
},
},
},
},
};
@EmanuelOcampo what I can see a mistake is that you are setting x
and y
options to point annotation which are wrong, they don't exist. Use xValue
and yValue
.
Nevertheless, a point should be shown in the center of chart area anyway, this makes me think that the plugin is not registered.
See https://www.chartjs.org/chartjs-plugin-annotation/latest/guide/integration.html