Skip to content

Charts global override for tooltips doesn't seem to work anymore #11107

@charlesmass2

Description

@charlesmass2

Expected behavior

As stated in the documentation here, we should be able to set global overrides for the tooltips.
In v3, I could globally disable the tooltips using the following:

import { Chart } from 'chart.js';
Chart.overrides.doughnut.plugins.tooltip.callbacks.label = () => null;

Current behavior

When using the code above, I get the following error: Cannot read properties of undefined (reading 'callbacks')
When outputting the content of Chart overrides in the console, I see this:

{
  "bar": { ... },
  "bubble": { ... },
  "doughnut": {
    "aspectRatio": 1,
    "plugins": {
      "legend": {
        "labels": {}
      }
    }
  },
  ...
}

Which suggests the documentation is wrong ?

Reproducible sample

https://codepen.io/lamasse/pen/WNKLbeV

Optional extra steps/info to reproduce

Please open the console in the codepen to see the issue

Possible solution

It might be a documentation issue only.

Context

No response

chart.js version

v4.2.0

Browser name and version

Chrome 109

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