{"_id":"d3-cloud","_rev":"3000974","name":"d3-cloud","description":"Generate word clouds in JavaScript.","dist-tags":{"latest":"1.2.7"},"maintainers":[{"name":"jasondavies","email":""}],"time":{"modified":"2023-08-29T08:54:57.000Z","created":"2015-09-23T16:08:14.954Z","1.2.7":"2023-08-07T23:45:39.196Z","1.2.6":"2023-08-07T23:24:08.349Z","1.2.5":"2018-02-03T10:20:06.101Z","1.2.4":"2017-01-12T15:54:31.425Z","1.2.3":"2017-01-12T15:38:58.827Z","1.2.1":"2015-10-15T10:30:20.773Z","1.2.0":"2015-09-24T21:47:43.986Z","1.1.2":"2015-09-23T16:08:14.954Z"},"users":{},"author":{"name":"Jason Davies","url":"https://www.jasondavies.com/"},"repository":{"type":"git","url":"git+https://github.com/jasondavies/d3-cloud.git"},"versions":{"1.2.7":{"name":"d3-cloud","version":"1.2.7","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"https://www.jasondavies.com/wordcloud/","license":"BSD-3-Clause","author":{"name":"Jason Davies","url":"https://www.jasondavies.com/"},"main":"build/d3.layout.cloud.js","module":"index","jsnext:main":"index","repository":{"type":"git","url":"git+https://github.com/jasondavies/d3-cloud.git"},"scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"^1.0.3"},"devDependencies":{"browserify":"^17.0.0"},"gitHead":"deea7d7165a4304d8eb123bd6b0e07aaae77ebea","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.7","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"shasum":"5a733c4bae43238cbb4760bb8f2d15912a8ad7a5","size":8824,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.7.tgz"},"_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"directories":{},"maintainers":[{"name":"jasondavies","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d3-cloud_1.2.7_1691451938973_0.8246321125246729"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-07T23:45:39.196Z","publish_time":1691451939196,"_source_registry_name":"default","_cnpm_publish_time":1691451939196},"1.2.6":{"name":"d3-cloud","version":"1.2.6","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"https://www.jasondavies.com/wordcloud/","license":"BSD-3-Clause","author":{"name":"Jason Davies","url":"https://www.jasondavies.com/"},"main":"build/d3.layout.cloud.js","module":"index","jsnext:main":"index","repository":{"type":"git","url":"git+https://github.com/jasondavies/d3-cloud.git"},"scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"^1.0.3"},"devDependencies":{"browserify":"^17.0.0"},"gitHead":"5e16861464e13b56413b27d860d3c6f234cb63e2","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.6","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"shasum":"0ab6658f1973ce5a49dd7761c420bc963a9339cd","size":8824,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.6.tgz"},"_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"directories":{},"maintainers":[{"name":"jasondavies","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d3-cloud_1.2.6_1691450648151_0.9178054262108428"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-07T23:24:08.349Z","publish_time":1691450648349,"_source_registry_name":"default","_cnpm_publish_time":1691450648349},"1.2.5":{"name":"d3-cloud","version":"1.2.5","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"https://www.jasondavies.com/wordcloud/","license":"BSD-3-Clause","author":{"name":"Jason Davies","url":"https://www.jasondavies.com/"},"main":"build/d3.layout.cloud.js","module":"index","jsnext:main":"index","repository":{"type":"git","url":"git+https://github.com/jasondavies/d3-cloud.git"},"scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"^1.0.3"},"devDependencies":{"browserify":"^11.2.0"},"gitHead":"1b91cada382e6f26cabf95db753bb6a41e95040b","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.5","_npmVersion":"5.5.1","_nodeVersion":"9.3.0","_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"maintainers":[{"name":"jasondavies","email":""}],"dist":{"shasum":"3e91564f2d27fba47fcc7d812eb5081ea24c603d","size":8761,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.5.tgz"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/d3-cloud-1.2.5.tgz_1517653205073_0.2645122546236962"},"directories":{},"publish_time":1517653206101,"_hasShrinkwrap":false,"_cnpm_publish_time":1517653206101,"_cnpmcore_publish_time":"2021-12-16T15:19:24.244Z"},"1.2.4":{"name":"d3-cloud","version":"1.2.4","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"http://www.jasondavies.com/wordcloud/","author":{"name":"Jason Davies","url":"http://www.jasondavies.com/"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git+ssh://git@github.com/jasondavies/d3-cloud.git"},"main":"index.js","scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"1"},"devDependencies":{"browserify":"^11.2.0"},"gitHead":"f00a511341fb4c9d9fce2faacea212687d653915","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.4","_shasum":"3e169403adab74fdb0c867638d7f0bb8e6ae71ff","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"maintainers":[{"name":"jasondavies","email":""}],"dist":{"shasum":"3e169403adab74fdb0c867638d7f0bb8e6ae71ff","size":8798,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.4.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/d3-cloud-1.2.4.tgz_1484236469339_0.5239274648483843"},"directories":{},"publish_time":1484236471425,"_hasShrinkwrap":false,"_cnpm_publish_time":1484236471425,"_cnpmcore_publish_time":"2021-12-16T15:19:24.470Z"},"1.2.3":{"name":"d3-cloud","version":"1.2.3","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"http://www.jasondavies.com/wordcloud/","author":{"name":"Jason Davies","url":"http://www.jasondavies.com/"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git+ssh://git@github.com/jasondavies/d3-cloud.git"},"main":"index.js","scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"1"},"devDependencies":{"browserify":"^11.2.0"},"gitHead":"1912f4b457744b53e87f526dd493ccb4bf3594c4","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.3","_shasum":"19d6df75b940f14d981451245e6991aa20477f92","_from":".","_npmVersion":"4.0.5","_nodeVersion":"7.4.0","_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"maintainers":[{"name":"jasondavies","email":""}],"dist":{"shasum":"19d6df75b940f14d981451245e6991aa20477f92","size":8713,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.3.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/d3-cloud-1.2.3.tgz_1484235538178_0.7767083484213799"},"directories":{},"publish_time":1484235538827,"_hasShrinkwrap":false,"_cnpm_publish_time":1484235538827,"_cnpmcore_publish_time":"2021-12-16T15:19:24.738Z"},"1.2.1":{"name":"d3-cloud","version":"1.2.1","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"http://www.jasondavies.com/wordcloud/","author":{"name":"Jason Davies","url":"http://www.jasondavies.com/"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git+ssh://git@github.com/jasondavies/d3-cloud.git"},"main":"index.js","scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"0.2.x"},"devDependencies":{"browserify":"^11.2.0"},"gitHead":"7d6fabeb7ad461cdac8f836896a7b93d2202002d","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.1","_shasum":"a9cfdf3fb855804a9800866229bf016f71bd379a","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.0","_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"maintainers":[{"name":"jasondavies","email":""}],"dist":{"shasum":"a9cfdf3fb855804a9800866229bf016f71bd379a","size":8689,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.1.tgz"},"directories":{},"publish_time":1444905020773,"_hasShrinkwrap":false,"_cnpm_publish_time":1444905020773,"_cnpmcore_publish_time":"2021-12-16T15:19:24.955Z"},"1.2.0":{"name":"d3-cloud","version":"1.2.0","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"http://www.jasondavies.com/wordcloud/","author":{"name":"Jason Davies","url":"http://www.jasondavies.com/"},"license":"BSD-3-Clause","repository":{"type":"git","url":"git+ssh://git@github.com/jasondavies/d3-cloud.git"},"main":"index.js","scripts":{"build":"mkdir -p build && browserify --standalone d3.layout.cloud index.js > build/d3.layout.cloud.js"},"dependencies":{"d3-dispatch":"0.2.x"},"devDependencies":{"browserify":"^11.2.0"},"gitHead":"85ff7b760be786c3e1d7b430c5c2b939b4e80897","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.2.0","_shasum":"5902fc1021075b2ac9a18409502178168506b4a4","_from":".","_npmVersion":"3.3.3","_nodeVersion":"4.1.0","_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"maintainers":[{"name":"jasondavies","email":""}],"dist":{"shasum":"5902fc1021075b2ac9a18409502178168506b4a4","size":7219,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.2.0.tgz"},"directories":{},"publish_time":1443131263986,"_hasShrinkwrap":false,"_cnpm_publish_time":1443131263986,"_cnpmcore_publish_time":"2021-12-16T15:19:25.245Z"},"1.1.2":{"name":"d3-cloud","version":"1.1.2","description":"Generate word clouds in JavaScript.","keywords":["word","cloud","tag","visualization","canvas"],"homepage":"http://www.jasondavies.com/wordcloud/","author":{"name":"Jason Davies","url":"http://www.jasondavies.com/"},"repository":{"type":"git","url":"http://github.com/jasondavies/d3-cloud.git"},"main":"index.js","dependencies":{"d3":"3.x","canvas":"1.2.x"},"gitHead":"0e8c6ba8bb06fd13e03a568b5f3442ccfcc518ed","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"_id":"d3-cloud@1.1.2","scripts":{},"_shasum":"11407b1eab6984a29564d37978d67044d30c59a7","_from":".","_npmVersion":"2.14.3","_nodeVersion":"4.1.0","_npmUser":{"name":"jasondavies","email":"jason@jasondavies.com"},"maintainers":[{"name":"jasondavies","email":""}],"dist":{"shasum":"11407b1eab6984a29564d37978d67044d30c59a7","size":81030,"noattachment":false,"key":"/d3-cloud/-/d3-cloud-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/d3-cloud/download/d3-cloud-1.1.2.tgz"},"directories":{},"publish_time":1443024494954,"_hasShrinkwrap":false,"_cnpm_publish_time":1443024494954,"_cnpmcore_publish_time":"2021-12-16T15:19:25.561Z"}},"readme":"# Word Cloud Layout\n\nThis is a [Wordle](http://www.wordle.net/)-inspired word cloud layout written\nin JavaScript. It uses HTML5 canvas and sprite masks to achieve\nnear-interactive speeds.\n\nSee [here](http://www.jasondavies.com/wordcloud/) for an interactive\ndemonstration along with implementation details.\n\n![Example cloud of Twitter search results for “amazing”](http://www.jasondavies.com/wordcloud/amazing.png)\n\n## Usage\n\nSee the samples in `examples/`.\n\n## API Reference\n\n<a name=\"cloud\" href=\"#cloud\">#</a> d3.layout.<b>cloud</b>()\n\nConstructs a new cloud layout instance.\n\n<a name=\"on\" href=\"#on\">#</a> <b>on</b>(<i>type</i>, <i>listener</i>)\n\nRegisters the specified *listener* to receive events of the specified *type*\nfrom the layout. Currently, only \"word\" and \"end\" events are supported.\n\nA \"word\" event is dispatched every time a word is successfully placed.\nRegistered listeners are called with a single argument: the word object that\nhas been placed.\n\nAn \"end\" event is dispatched when the layout has finished attempting to place\nall words.  Registered listeners are called with two arguments: an array of the\nword objects that were successfully placed, and a *bounds* object of the form\n`[{x0, y0}, {x1, y1}]` representing the extent of the placed objects.\n\n<a name=\"start\" href=\"#start\">#</a> <b>start</b>()\n\nStarts the layout algorithm.  This initialises various attributes on the word\nobjects, and attempts to place each word, starting with the largest word.\nStarting with the centre of the rectangular area, each word is tested for\ncollisions with all previously-placed words.  If a collision is found, it tries\nto place the word in a new position along the spiral.\n\n**Note:** if a word cannot be placed in any of the positions attempted along\nthe spiral, it is **not included** in the final word layout.  This may be\naddressed in a future release.\n\n<a name=\"stop\" href=\"#stop\">#</a> <b>stop</b>()\n\nStops the layout algorithm.\n\n<a name=\"timeInterval\" href=\"#timeInterval\">#</a> <b>timeInterval</b>([<i>time</i>])\n\nInternally, the layout uses `setInterval` to avoid locking up the browser’s\nevent loop.  If specified, **time** is the maximum amount of time that can be\nspent during the current timestep.  If not specified, returns the current\nmaximum time interval, which defaults to `Infinity`.\n\n<a name=\"words\" href=\"#words\">#</a> <b>words</b>([<i>words</i>])\n\nIf specified, sets the **words** array.  If not specified, returns the current\nwords array, which defaults to `[]`.\n\n<a name=\"size\" href=\"#size\">#</a> <b>size</b>([<i>size</i>])\n\nIf specified, sets the rectangular `[width, height]` of the layout.  If not\nspecified, returns the current size, which defaults to `[1, 1]`.\n\n<a name=\"font\" href=\"#font\">#</a> <b>font</b>([<i>font</i>])\n\nIf specified, sets the **font** accessor function, which indicates the font\nface for each word.  If not specified, returns the current font accessor\nfunction, which defaults to `\"serif\"`.\nA constant may be specified instead of a function.\n\n<a name=\"fontStyle\" href=\"#fontStyle\">#</a> <b>fontStyle</b>([<i>fontStyle</i>])\n\nIf specified, sets the **fontStyle** accessor function, which indicates the\nfont style for each word.  If not specified, returns the current fontStyle\naccessor function, which defaults to `\"normal\"`.\nA constant may be specified instead of a function.\n\n<a name=\"fontWeight\" href=\"#fontWeight\">#</a> <b>fontWeight</b>([<i>fontWeight</i>])\n\nIf specified, sets the **fontWeight** accessor function, which indicates the\nfont weight for each word.  If not specified, returns the current fontWeight\naccessor function, which defaults to `\"normal\"`.\nA constant may be specified instead of a function.\n\n<a name=\"fontSize\" href=\"#fontSize\">#</a> <b>fontSize</b>([<i>fontSize</i>])\n\nIf specified, sets the **fontSize** accessor function, which indicates the\nnumerical font size for each word.  If not specified, returns the current\nfontSize accessor function, which defaults to:\n\n```js\nfunction(d) { return Math.sqrt(d.value); }\n```\n\nA constant may be specified instead of a function.\n\n<a name=\"rotate\" href=\"#rotate\">#</a> <b>rotate</b>([<i>rotate</i>])\n\nIf specified, sets the **rotate** accessor function, which indicates the\nrotation angle (in degrees) for each word.  If not specified, returns the\ncurrent rotate accessor function, which defaults to:\n\n```js\nfunction() { return (~~(Math.random() * 6) - 3) * 30; }\n```\n\nA constant may be specified instead of a function.\n\n<a name=\"text\" href=\"#text\">#</a> <b>text</b>([<i>text</i>])\n\nIf specified, sets the **text** accessor function, which indicates the text for\neach word.  If not specified, returns the current text accessor function, which\ndefaults to:\n\n```js\nfunction(d) { return d.text; }\n```\n\nA constant may be specified instead of a function.\n\n<a name=\"spiral\" href=\"#spiral\">#</a> <b>spiral</b>([<i>spiral</i>])\n\nIf specified, sets the current type of spiral used for positioning words.  This\ncan either be one of the two built-in spirals, \"archimedean\" and \"rectangular\",\nor an arbitrary spiral generator can be used, of the following form:\n\n```js\n// size is the [width, height] array specified in cloud.size\nfunction(size) {\n  // t indicates the current step along the spiral; it may monotonically\n  // increase or decrease indicating clockwise or counterclockwise motion.\n  return function(t) { return [x, y]; };\n}\n```\n\nIf not specified, returns the current spiral generator, which defaults to the\nbuilt-in \"archimedean\" spiral.\n\n<a name=\"padding\" href=\"#padding\">#</a> <b>padding</b>([<i>padding</i>])\n\nIf specified, sets the **padding** accessor function, which indicates the\nnumerical padding for each word.  If not specified, returns the current\npadding, which defaults to 1.\n\n<a name=\"random\" href=\"#random\">#</a> <b>random</b>([<i>random</i>])\n\nIf specified, sets the internal random number generator, used for selecting the\ninitial position of each word, and the clockwise/counterclockwise direction of\nthe spiral for each word.  This should return a number in the range `[0, 1)`.\n\nIf not specified, returns the current random number generator, which defaults\nto `Math.random`.\n\n<a name=\"canvas\" href=\"#canvas\">#</a> <b>canvas</b>([<i>canvas</i>])\n\nIf specified, sets the **canvas** generator function, which is used internally\nto draw text.  If not specified, returns the current generator function, which\ndefaults to:\n\n```js\nfunction() { return document.createElement(\"canvas\"); }\n```\n\nWhen using Node.js, you will almost definitely override this default, e.g.\nusing the [canvas module](https://www.npmjs.com/package/canvas).\n","_attachments":{},"homepage":"https://www.jasondavies.com/wordcloud/","bugs":{"url":"https://github.com/jasondavies/d3-cloud/issues"},"license":"BSD-3-Clause"}