Skip to content

Cannot read properties of null (reading 'getLabelAndValue') in function createTooltipItem() of plugin.tooltip.js #11315

@schavelev

Description

@schavelev

Expected behavior

No error message

Current behavior

Sometimes the following error occurs:
plugin.tooltip.js:123 Uncaught TypeError: Cannot read properties of null (reading 'getLabelAndValue')
at createTooltipItem (plugin.tooltip.js:123:37)
at Tooltip._createItems (plugin.tooltip.js:603:25)
at Tooltip.update (plugin.tooltip.js:645:27)
at Tooltip.handleEvent (plugin.tooltip.js:1160:14)
at Object.afterEvent (plugin.tooltip.js:1257:25)
at callback (helpers.core.ts:109:15)
at PluginService._notify (core.plugins.js:60:11)
at PluginService.notify (core.plugins.js:42:25)
at Chart.notifyPlugins (core.controller.js:1148:26)
at Chart._eventHandler (core.controller.js:1197:10)
createTooltipItem @ plugin.tooltip.js:123
_createItems @ plugin.tooltip.js:603
update @ plugin.tooltip.js:645
handleEvent @ plugin.tooltip.js:1160
afterEvent @ plugin.tooltip.js:1257
callback @ helpers.core.ts:109
_notify @ core.plugins.js:60
notify @ core.plugins.js:42
notifyPlugins @ core.controller.js:1148
_eventHandler @ core.controller.js:1197
listener @ core.controller.js:1006
(anonymous) @ platform.dom.js:243
(anonymous) @ helpers.extras.ts:40
requestAnimationFrame (async)
(anonymous) @ helpers.extras.ts:38

This error occurs when the mouse pointer is in the canvas area, but the canvas container is in the process of being destroyed.

error

Reproducible sample

const {label, value} = controller.getLabelAndValue(index);

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v4.3.0

Browser name and version

Google Chrome 113.0.5672.127

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions