Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

label annotation not showing #926

Open
EmanuelOcampo opened this issue Mar 21, 2024 · 1 comment
Open

label annotation not showing #926

EmanuelOcampo opened this issue Mar 21, 2024 · 1 comment

Comments

@EmanuelOcampo
Copy link

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,
},

    },
  },
},

};

Screenshot 2024-03-21 at 7 58 08 PM
@stockiNail
Copy link
Collaborator

@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.

See doc: https://www.chartjs.org/chartjs-plugin-annotation/latest/guide/types/point.html#point-annotation-specific-options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants