Closed remember9069 closed 1 year ago
Strictly speaking, you don't need D3 to use d3-cloud, although that's the most common scenario. d3-cloud is a completely standalone module. If you're using ESM you should be able to do:
import d3_cloud from "d3-cloud";
const cloud = d3_cloud();
...
Strictly speaking, you don't need D3 to use d3-cloud, although that's the most common scenario. d3-cloud is a completely standalone module. If you're using ESM you should be able to do:
import d3_cloud from "d3-cloud"; const cloud = d3_cloud(); ...
Thank you very much for the quick and helpful reply. After I did what you said, it appears
This expression is not callable.
Type 'Cloud<Word>' has no call signatures.js(2349)
and in console shows
Uncaught TypeError: cloud is not a function
Regarding this line var layout = cloud()
var layout = d3_cloud()
var layout = d3_cloud()
Yes, i found that mistake as well, thanks.
When i import this as
import * as d3 from 'd3'
, showsUncaught TypeError: Cannot read properties of undefined (reading 'cloud')
in console, in line where i callcloud = d3.layout.cloud();
And if i import this asimport * as cloud from "d3-cloud"
, it showsCannot find module 'd3-cloud' or its corresponding type declarations.