We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I expect to not have to type cast and do dynamic check to access a property that is there.
onClick: (event, activeChartElements, chart) => { if (isEmpty(activeChartElements)) { return; } const { element } = activeChartElements[0]; if ('$context' in element && typeof element.$context === 'object') { const context = element.$context as { raw: { x: string; y: number } }; if ('raw' in context) { const rawDataPoint = context.raw; } }
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwOXAwemDSAFyk6sBxJOnZuSLoMOglCNW5ueroAEbS6nQlANqmAErSIqaZpjrqEtKjcKYAml3qEPEzpgDiUNJyqwAKElBgmqsA8lC+yqYAulWsLS219XQqPXC9Tbd3n22d6iUkAMRwCB4OAANQgMGkDBun0+DwarwAjAAmTKIgCcmQAzJkAKyZVFwLHXZp3bCXUnYGG5CBgGDACCyF7vT50MjoTTM0ktPiNbl3fk5KmCuB6PkfWFwEXYfnCiVA2TIMpkADWJWM0g4wUy6F4wC10TUmm0MDomQo1nsggAfFl2PKcmRGXR4EgukF5DghA49QbkoETXRegAGS6hT4AegjeVQwCc0j4cfgjLg7W4FqwZGVKqlDp4zvgZ0SwndJqoABInfIEwoi+HcjLWNhbIwgA
No response
Add $context to Element type.
4.4.3
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Expected behavior
I expect to not have to type cast and do dynamic check to access a property that is there.
Current behavior
Reproducible sample
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwOXAwemDSAFyk6sBxJOnZuSLoMOglCNW5ueroAEbS6nQlANqmAErSIqaZpjrqEtKjcKYAml3qEPEzpgDiUNJyqwAKElBgmqsA8lC+yqYAulWsLS219XQqPXC9Tbd3n22d6iUkAMRwCB4OAANQgMGkDBun0+DwarwAjAAmTKIgCcmQAzJkAKyZVFwLHXZp3bCXUnYGG5CBgGDACCyF7vT50MjoTTM0ktPiNbl3fk5KmCuB6PkfWFwEXYfnCiVA2TIMpkADWJWM0g4wUy6F4wC10TUmm0MDomQo1nsggAfFl2PKcmRGXR4EgukF5DghA49QbkoETXRegAGS6hT4AegjeVQwCc0j4cfgjLg7W4FqwZGVKqlDp4zvgZ0SwndJqoABInfIEwoi+HcjLWNhbIwgA
Optional extra steps/info to reproduce
No response
Possible solution
Add $context to Element type.
Context
No response
chart.js version
4.4.3
Browser name and version
No response
Link to your project
No response
The text was updated successfully, but these errors were encountered: