• Stars
    star
    2,351
  • Rank 19,566 (Top 0.4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tag cloud/Wordle presentation on 2D canvas or HTML

wordcloud2.js npm version

Create a tag cloud/Wordle presentation on 2D canvas or HTML.

This library is a spin-off project from HTML5 Word Cloud.

Visit the demo page

Installation

npm install wordcloud

Simple usage

Download the latest wordcloud2.js file from the src folder in this repository.

Load wordcloud2.js script to the web page, and run:

WordCloud(document.getElementById('my_canvas'), { list: list } );

where list is an array that look like this: [['foo', 12], ['bar', 6]].

Options available, see API documentation for detail.

Contact & help

Please read through the API documentation and CONTRIBUTING.md before filing an issue or contact me via e-mail.

Algorithm

Before putting each word on the canvas, it is drawn on a separate canvas to read back the pixels to record is drawn spaces. With the information, wordcloud.js will then try to find a place to fit the word that is closest to the start point.

Testing

Tests are available with QUnit and grunt. To setup environment for testing, run npm install and manually install SlimerJS of your platform.

Use grunt test to ensure all options can be set without JavaScript error.

Use grunt compare --base-commit=gh-pages to compare your proposed fix with gh-pages branch.

Acknowledgement

The developer would like to thank Chad Jensen for sponsoring the work on image masking on the demo page.

More Repositories

1

wordcloud

HTML5 Word Cloud
JavaScript
647
star
2

jszhuyin

JS 注音:JavaScript 自動選字注音輸入法;"Smart" Chinese Zhuyin Input Method in JavaScript.
JavaScript
223
star
3

wordfreq

Text corpus calculation in Javascript. Supports Chinese, English.
HTML
80
star
4

google-oauth2-web-client

Login with Google using OAuth2 for client-side web app
JavaScript
33
star
5

html5-file-upload

Upload files using interfaces supplied by HTML5 browsers, instead of SWFUpload or IFRAME.
JavaScript
31
star
6

simworker

Simulated Web Workers
JavaScript
27
star
7

gaia-keyboard-demo

Online demo page for Mozilla Firefox OS Keyboard
JavaScript
22
star
8

invoice-helper

我要開發票:手開發票檢查小幫手。
JavaScript
17
star
9

rep-locator

尋找您的民意代表
JavaScript
13
star
10

jszhuyin-firefox

An offline Smart Zhuyin IME add-on for Firefox. Built on top of JSZhuyin and add-on SDK.
JavaScript
6
star
11

apache2-vhost-config

A set of scripts to do one-stroke virtual host setup with apache2 package in Debian/Ubuntu
Shell
5
star
12

cacertblock

CA Untrustworthy: Delete or disable CA certificates owned by CNNIC
JavaScript
4
star
13

hmm

A simple Hidden Markov Model implementation
JavaScript
4
star
14

zh-font-tweak

Overwrite default Chinese fonts settings in Firefox.
JavaScript
3
star
15

wp-script

WordPress upgrade/install script
Shell
2
star
16

s3drop

A client-side web application for Amazom S3, as a personal file sharing space.
JavaScript
2
star
17

citationNeeded.js

Insert [citation needed] to systemic biased Wikipedia articles
JavaScript
1
star
18

ie9toss

HTML5 demo made at IE9 Hackathon held by Microsoft Taiwan
JavaScript
1
star
19

rpi-tools

Step-by-step scripts to semi-automatically setup an OpenVPN server on Raspberry Pi
Shell
1
star
20

google-apps-openid

OpenID discovery information in XRDS necessary for Google Apps Hosted Dommains OpenID to work.
PHP
1
star
21

wids-demo

1
star
22

dinbendon-reminder

提醒目前 Din.Ben.Don! 網站上未登記的訂單。
JavaScript
1
star
23

appcacheui

AppCacheUI.js
JavaScript
1
star
24

vvpn

Create and re-create OpenVPN server on-demand on VPS
Shell
1
star
25

gaia-keyboard-ios

(Incomplete) Gaia Keyboard running on iOS
JavaScript
1
star
26

jquery-ctbox

(untested) jQuery helper plug-in for CT-BOX Chinese web font delivered in subset font.
JavaScript
1
star