• Topic
  • Discussion
  • OATWikiWeb.OATDOCtagcloud(Last) -- Owiki? , 2016-08-19 14:58:52 Edit owiki 2016-08-19 14:58:52

    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, 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();
    

    Referenced by...