jasondavies / d3-cloud

Create word clouds in JavaScript.
https://www.jasondavies.com/wordcloud/
Other
3.82k stars 1.07k forks source link

Will this be updated for v4? #107

Closed emeeks closed 7 years ago

emeeks commented 7 years ago

I describe this layout in one of the chapters of my book and I'm updating that to the 2nd edition for d3v4 and I was wondering if there will be a v4 version of this chart forthcoming. If not, no worries, I can replace the word cloud section with something else.

jasondavies commented 7 years ago

What do you mean by “v4 version”?

aknuds1 commented 7 years ago

@jasondavies He means the D3 v4 API

jasondavies commented 7 years ago

This library has a single dependency, d3-dispatch, so I don’t think anything needs to be done for D3 v4 compatibility. If you think something does need to be done, please reopen and provide details.

aknuds1 commented 7 years ago

@jasondavies Maybe you should have a look at the v4 PR and voice your opinion?

feifang commented 7 years ago

It still works with D3 v4 :) Most code examples online fails because of the error: d3.layout.cloud() is not a function. I encountered the same error while using d3-cloud in my Vue app, but eventually solved it (inspired by the d3-cloud examples):

import * as cloud from 'd3-cloud'
// ...
// instead of using d3.layout.cloud()
var layout = cloud()
              .size([width, height])
              .words(words)
// ...
gustavz commented 4 years ago

It still works with D3 v4 :) Most code examples online fails because of the error: d3.layout.cloud() is not a function. I encountered the same error while using d3-cloud in my Vue app, but eventually solved it (inspired by the d3-cloud examples):

import * as cloud from 'd3-cloud'
// ...
// instead of using d3.layout.cloud()
var layout = cloud()
              .size([width, height])
              .words(words)
// ...

How is this supposed to work?

RudyBai commented 3 years ago

Hey all, I have the same issue with creating a wordcloud in React using raw D3v4 by accessing an svg ref using a hook. Using the snippet previously mentioned yields

This expression is not callable.
  Type '{ default: { (): Cloud<Word>; <T extends Word>(): Cloud<T>; }; }' has no call signatures.  TS2349
RudyBai commented 3 years ago

Nevermind! Using import cloud from "d3-cloud"; instead works! import * as cloud from 'd3-cloud' wouldn't.