Index | OAT homepage | OpenLink Software

# OATDOCtagcloud

- OATDOCtagcloud
- _ _ tagcloud.js
- _ _ _ _ Objects
- _ _ _ _ _ _ OAT.TagCloud(div, optionsObject)
- _ _ _ _ Methods
- _ _ _ _ _ _ OAT.TagCloud.clearItems()
- _ _ _ _ _ _ OAT.TagCloud.addItem(name, link[, frequency])
- _ _ _ _ _ _ OAT.TagCloud.draw()
- _ _ _ _ Constants
- _ _ _ _ _ _ OAT.TagCloudData.COLOR_SIZE
- _ _ _ _ _ _ OAT.TagCloudData.COLOR_CYCLE
- _ _ _ _ _ _ OAT.TagCloudData.COLOR_RANDOM
- _ _ _ _ Example

## 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` :

- `separator` - string which separates individual entries
- `colors` - array of colors to be used
- `sizes` - array of font sizes to be used
- `colorMapping` - one of the `OAT.TagCloudData.COLOR_` constants

### 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, `frequency` is 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();

Copyright (C) 2005-2008 OpenLink Software