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 data
4
var data = [
5
{x: "learning", value: 80, category: "noun"},
6
{x: "includes", value: 56, category: "verb"},
7
{x: "lists", value: 44, category: "noun"},
8
{x: "meaning", value: 40, category: "noun"},
9
{x: "useful", value: 36, category: "adjective"},
10
{x: "different", value: 32, category: "adjective"},
11
{x: "grammar", value: 28, category: "noun"},
12
{x: "teaching", value: 24, category: "noun"},
13
{x: "example", value: 20, category: "noun"},
14
{x: "thing", value: 12, category: "noun"}
15
];
16
17
// create a chart and set the data
18
var chart = anychart.tagCloud(data);
19
20
// enable the legend
21
chart.legend(true);
22
23
// set the chart title
24
chart.title("Tag Cloud Chart: Legend");
25
26
// set the container id
27
chart.container("container");
28
29
// initiate drawing the chart
30
chart.draw();
31
});