tagcloud.js

Displays a "Tag Cloud", a visually enhanced set of links.

Objects

OAT.TagCloud(div, optionsObject)

Creates a Tag Cloud inside div. Options are specified in optionsObject:

Methods

OAT.TagCloud.clearItems()

Removes all items (links).

OAT.TagCloud.addItem(name, link[, frequency])

Adds a new item. Its label is name, link is an URL. Third argument, frequencyis optional and defaults to 1.

OAT.TagCloud.draw()

Draws the Tag Cloud.

Constants

OAT.TagCloudData.COLOR_SIZE

Create color based on size (frequency).

OAT.TagCloudData.COLOR_CYCLE

Periodically cycle all specified colors.

OAT.TagCloudData.COLOR_RANDOM

Use randomly chosen color for each item.

Example


var colors = ["#f00","#0f0","#00f"];
var sizes = ["80%","100%","120%"];
var tc = new OAT.TagCloud("myDiv",{separator:", ", 
                          colorMapping:OAT.TagCloudData.COLOR_SIZE, 
                          colors:colors, sizes:sizes});

tc.addItem("Label 1", "http://", 10);
tc.addItem("Label 2", "http://", 5);
tc.addItem("Label 3", "http://"); /* frequency == 1 */

tc.draw();

CategoryDocumentation CategoryOAT CategoryOpenSource