1
0
Fork
You've already forked tag-cloud
0
Generate a tag cloud, with different font sizes based on the frequency of each word
  • JavaScript 100%
2023年06月07日 23:33:36 +01:00
examples use the lib from npm in the examples 2023年06月07日 23:33:36 +01:00
test add order & font size params 2023年06月07日 23:03:24 +01:00
types rename (again) tag-cloud to tags-cloud because the name was taken on npm 2023年06月07日 23:28:12 +01:00
.gitignore add order & font size params 2023年06月07日 23:03:24 +01:00
.npmignore add order & font size params 2023年06月07日 23:03:24 +01:00
index.js add order & font size params 2023年06月07日 23:03:24 +01:00
LICENSE Add LICENSE 2023年06月07日 21:11:22 +00:00
package-lock.json bump version 2023年06月07日 23:28:49 +01:00
package.json rename (again) tag-cloud to tags-cloud because the name was taken on npm 2023年06月07日 23:28:12 +01:00
README.md rename (again) tag-cloud to tags-cloud because the name was taken on npm 2023年06月07日 23:28:12 +01:00
tag-cloud.png add order & font size params 2023年06月07日 23:03:24 +01:00

Tag Cloud

Lightweight tag cloud generator.

It generates different font sizes (in rems), for each word, based on their frequency.

tag cloud example with random words

Install & Run tests

  • Install: npm install tags-cloud

How to use

tagCloud(tagList, order='default', minFontSize=1, maxFontSize=2);

import { tagCloud } from 'tags-cloud';
const tagList = [{ name: 'tag', count: '8' }, { name: 'cloud', count: '1' }];
// Default order (the current order of your tagList)
tagCloud(tagList, 'default');
// Ascending order
tagCloud(tagList, 'asc');
// Descending order
tagCloud(tagList, 'desc');
// Random order
tagCloud(tagList, 'random');
// Aplhabetical order
tagCloud(tagList, 'alphabetical');
// Defining the min and max font size (in rems)
tagCloud(tagList, 'default', 2, 6);

Types

Code examples: