Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Document requirement of 'this' when calling tick formatters #12064

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

Merged
merged 1 commit into from
Apr 18, 2025

Conversation

joshkel
Copy link
Contributor

@joshkel joshkel commented Apr 16, 2025

The numeric and logarithmic tick formatters require that this be provided. That happens automatically if they're used directly as a tick callback but not if they're invoked manually. Failing to pass this results in runtime errors similar to the following:

TypeError: Cannot read properties of undefined (reading 'chart')

The `numeric` and `logarithmic` tick formatters require that `this` be provided. That happens automatically if they're used directly as a tick callback but not if they're invoked manually. Failing to pass `this` results in runtime errors similar to the following:

```
TypeError: Cannot read properties of undefined (reading 'chart')
```
@etimberg etimberg added the type: types Typescript type changes label Apr 16, 2025
@etimberg etimberg added this to the Version 4.5.0 milestone Apr 16, 2025
@LeeLenaleee LeeLenaleee merged commit 3361a63 into chartjs:master Apr 18, 2025
7 checks passed
@joshkel joshkel deleted the tick-formatters-this branch April 18, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: types Typescript type changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.