HTMLcopy
1
<label><input onclick="tagCloudMode('spiral')" type="radio" name="type" checked>Spiral Mode</label>
2
<label><input onclick="tagCloudMode('rect')" type="radio" name="type">Rectangle Mode</label>
3
<div id="container"></div>
CSScopy
16
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
label {
8
display: inline-block;
9
margin: 10px 0 0 10px;
10
}
11
#container {
12
position: absolute;
13
width: 100%;
14
top: 35px;
15
bottom: 0;
16
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create data
4
var data = "Tyger, tyger, burning bright " +
5
"In the forests of the night, " +
6
"What immortal hand or eye " +
7
"Could frame thy fearful symmetry? " +
8
"In what distant deeps or skies " +
9
"Burnt the fire of thine eyes? " +
10
"On what wings dare he aspire? " +
11
"What the hand dare seize the fire? " +
12
"And what shoulder and what art " +
13
"Could twist the sinews of thy heart? " +
14
"And, when thy heart began to beat, " +
15
"What dread hand and what dread feet? " +
16
"What the hammer? what the chain? " +
17
"In what furnace was thy brain? " +
18
"What the anvil? what dread grasp " +
19
"Dare its deadly terrors clasp? " +
20
"When the stars threw down their spears, " +
21
"And watered heaven with their tears, " +
22
"Did He smile His work to see? " +
23
"Did He who made the lamb make thee? " +
24
"Tyger, tyger, burning bright " +
25
"In the forests of the night, " +
26
"What immortal hand or eye " +
27
"Dare frame thy fearful symmetry? ";
28
29
// create a chart
30
chart = anychart.tagCloud();
31
32
// configure angles
33
chart.angles([0]);
34
35
// set the parsing mode
36
chart.data(data, {mode: "by-word"});
37
38
// set the chart title
39
chart.listen("chartDraw", function () {
40
chart.title("Tag Cloud Chart: Mode = " + chart.mode());
41
});
42
43
// set the container id
44
chart.container("container");
45
46
// initiate drawing the chart
47
chart.draw();
48
});
49
50
// set the mode of the tag cloud
51
function tagCloudMode(mode) {
52
chart.mode(mode);
53
}