HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create a stage
4
var stage = anychart.graphics.create("container");
5
6
// create data
7
var data = [
8
{x: "learning", value: 100},
9
{x: "includes", value: 10},
10
{x: "lists", value: 10},
11
{x: "meaning", value: 1},
12
{x: "useful", value: 1},
13
{x: "different", value: 1},
14
{x: "grammar", value: 1},
15
{x: "teaching", value: 1},
16
{x: "example", value: 1},
17
{x: "thing", value: 1},
18
];
19
20
// set the position and data for the first tag cloud
21
var tagCloud1 = anychart.tagCloud(data);
22
tagCloud1.title("Linear Scale (Default)");
23
tagCloud1.bounds(0, 0, "50%", "100%");
24
//set the chart container
25
tagCloud1.container(stage)
26
//initiate drawing the chart
27
tagCloud1.draw();
28
29
// set the position and data for the second tag cloud
30
var tagCloud2 = anychart.tagCloud(data);
31
tagCloud2.title("Logarithmic Scale");
32
tagCloud2.bounds("50%", 0, "50%", "100%");
33
/* create a logarithmic scale and set it
34
as the value scale of the chart */
35
tagCloud2.scale(anychart.scales.log());
36
//set the chart container
37
tagCloud2.container(stage)
38
//initiate drawing the chart
39
tagCloud2.draw();
40
});