View on GitHub

MySQL Word Cloud

HTML5 Word Cloud from a MySQL Database

Download this project as a .zip file Download this project as a tar.gz file

Documentation

The MySQL Word Cloud basically uses two steps to generate the word cloud in the HTML5 Canvas element. The configuration options for both steps are passed through the jQuery call to wordCloud(...).

The first step in the process is done server-side via PHP and is responsible for connecting to the database and computing the frequency of words.

The second step in the process is done client-side via JavaScript/jQuery and is responsible for rendering an SVG word cloud inside of the canvas element specified. I cannot take credit for this part, most of it was done by timdream.

JavaScript Rendering Options

The wordCloud jQuery function takes a javascript object as it’s only parameter. This object can contain several parameters that control the appearance of the resulting word cloud.

Many of these parameters can be found in the comments of the original wordcloud plugin, developed by timdream.

Some additional parameters have been added as well:




Database Connection/Query Options

The following options control the querying of the MySQL database. They are all passed to the wordCloud function along with other word cloud options under the database : {} object.