Comments (6)
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:
Chart.register(...registerables, TreemapController, TreemapElement);
from chartjs-chart-treemap.
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.
from chartjs-chart-treemap.
Maybe you could try importing and registering Tooltip
?
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);
from chartjs-chart-treemap.
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).
from chartjs-chart-treemap.
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 main.ts
the registerables like:
import { Chart, registerables } from "chart.js";
import { TreemapController, TreemapElement } from "chartjs-chart-treemap";
Chart.register(TreemapController, TreemapElement, ...registerables);
which I think should import Tooltip and don't treeshake. Specifying it explicitly again/twice seems to work from my tests.
from chartjs-chart-treemap.
thank you kurkle for analyzing the problem, really appreciate this. I can confirm if I do Chart.register(...registerables, TreemapController, TreemapElement)
it works as intended. Kinda makes sense, but I did not expect an order in the register at first glance. Seeing the controller it makes sense.
from chartjs-chart-treemap.
Related Issues (20)
- When I zoom by chartjs-plugin-zoom library, the children of tree move on the screen, and the zooming speed is very slow in the mobile size.
- Misalignment with large dataset HOT 1
- Move options to dataset controller configuration
- Element width and height set to 0 HOT 2
- Upgrading Chart.JS to version 4.x, treemap throws error
- Not able to create treemap HOT 6
- Tree and data must be overridden in order to update the chart HOT 1
- Dividers option to be removed
- Missing version 2.3.0 on NPM HOT 1
- Groups working in wrong way? HOT 1
- Error using with webpack HOT 4
- Two datasets, rendering on same treemap - one rtl and other ltr
- How to not re-order data. HOT 1
- Using the treemap graph on TypeScript requires me to set an empty data array HOT 1
- Large variants in Dataset render error
- Going back when click center on drilldown feature
- v2.3.0 with chart.js 4.4.1 renders unwanted context.raw object HOT 4
- Uncaught TypeError: Cannot read properties of undefined (reading '_parseFont') !!!!!
- tooltip not showing linebreak on \r\n HOT 1
- Labels / DataLabels supporting word-wrap and/or clipping HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chartjs-chart-treemap.