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

Error when trying to show a tooltip during data updates #11206

Open
aeqz opened this issue Mar 28, 2023 · 1 comment
Open

Error when trying to show a tooltip during data updates #11206

aeqz opened this issue Mar 28, 2023 · 1 comment

Comments

@aeqz
Copy link

aeqz commented Mar 28, 2023

Expected behavior

If data changes are triggered due to the user interaction with the chart, like zoom and pan with chartjs-plugin-zoom plugin, and tooltips are no explicitly configured (default options.plugins.tooltip configuration), there should not be unhandled JS errors due to this usage.

Current behavior

The following error is thrown randomly:

[Error] TypeError: undefined is not an object (evaluating 'parsed[iScale.axis]')
	getLabelAndValue (chunk-VGFJOCNB.js:969)
	createTooltipItem (chunk-VGFJOCNB.js:8917)
	_createItems (chunk-VGFJOCNB.js:9260)
	update (chunk-VGFJOCNB.js:9293)
	handleEvent (chunk-VGFJOCNB.js:9668)
	afterEvent (chunk-VGFJOCNB.js:9735)
	_notify (chunk-VGFJOCNB.js:5144)
	notify (chunk-VGFJOCNB.js:5127)
	_eventHandler (chunk-VGFJOCNB.js:6403)
	listener (chunk-VGFJOCNB.js:6278)
	(anonymous function) (chunk-VGFJOCNB.js:3455)
	(anonymous function) (chunk-5HRYR2VN.js:996)

It does not happen with so much frequency, but it just sometimes does.

Reproducible sample

None

Optional extra steps/info to reproduce

I'm really sorry to not provide a reproducible example, but after many attempts I have not even been able to come up with a sequence of steps to reproduce it.

Possible solution

In the getLabelAndValue functions from the library, check also whether parsed is undefined or not before accessing its properties.

Context

We are trying to reload a line chart data every time that the user does zoom or ends a pan gesture in order to show it to him with a suitable resolution. The client-side data decimation feature of Chart.js did not work well for us in this case.

Also, we use a React setup.

chart.js version

v4.2.1

Browser name and version

Safari 16.3

Link to your project

No response

@zigomir
Copy link

zigomir commented Feb 14, 2024

Not sure if related;

I had similar issue in a Vue app, but then figured that wrapping canvas element used by Chart.js in Transition component was related to this problem, removing Transition component solved the issue for me 🤷‍♂️

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