-
Notifications
You must be signed in to change notification settings - Fork 32
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
undefined error firing while hovering the chart #88
Comments
Maybe you could try importing and registering Edit: just to make it clear, the top part: import { Vue, Component, Ref } from "vue-property-decorator";
import { Chart, Tooltip } from "chart.js";
import { TreemapController, TreemapElement } from "chartjs-chart-treemap";
Chart.register(Tooltip, TreemapController, TreemapElement); |
Also, if a the "Basic treemap example" text is rendered on the chart, I suspect this might be an issue with SSR. You could try disabling that for this component (don't as me how, I don't use Vue). |
ty for your help. It's client side rendered but the tooltip (I've tried already) import seems like it's working now. I've already imported in
which I think should import Tooltip and don't treeshake. Specifying it explicitly again/twice seems to work from my tests. |
I've usually created a file for doing the registration like: chart.js import { Chart, registerables } from "chart.js";
import { TreemapController, TreemapElement } from "chartjs-chart-treemap";
Chart.register(...registerables, TreemapController, TreemapElement);
export default Chart; component.js import Chart from './chart';
... But the actual fix is probably registering the ...registrables before TreemapController: |
And the explanation is here, if Tooltip is not registered before TreemapController, the tooltip positioner is not registered. chartjs-chart-treemap/src/controller.js Lines 372 to 386 in 971f84b
Should probably emit a warning about this. |
thank you kurkle for analyzing the problem, really appreciate this. I can confirm if I do |
I'm using
chart.js 3.7.1
andchartjs-chart-treemap 2.0.2
in an vue project. The chart renders but when I hover it does not show the tooltip and fires errors in console. Sometimes it worked when the live-server reloaded code and when I've did the imports inmain.ts
and in the component itself.the component looks like this
The text was updated successfully, but these errors were encountered: