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
60
1
anychart.onDocumentReady(function() {
2
3
// set stage
4
var stage = anychart.graphics.create("container");
5
6
// create table
7
var table = anychart.standalones.table();
8
9
// set table content
10
table.contents([
11
[
12
null,
13
null,
14
"2003 Sales",
15
"2004 Sales"
16
],[
17
"Winter",
18
"January",
19
"$10000",
20
"$12000"
21
],[
22
null,
23
"February",
24
"$12000",
25
"$15000"
26
],[
27
"Spring",
28
"March",
29
"$18000",
30
"$16000"
31
],[
32
null,
33
"April",
34
"$11000",
35
"$15000"
36
],[
37
null,
38
"May",
39
"$9000",
40
"$14000"
41
]
42
]);
43
44
// span cells
45
table.getCell(1,0).rowSpan(2);
46
table.getCell(3,0).rowSpan(3);
47
table.getCell(0,0).colSpan(2);
48
49
table.getRow(0).height(40).fontWeight(900); // Set height 40px for the first row and bold the text
50
table.getCol(0).width(70).fontWeight(900); // Set width 70 px for the first column and bold the text
51
table.getCol(1).width(70).fontWeight(900); // Set width 70 px for the second column and bold the text
52
53
// set border style
54
table.cellBorder("#B8B8B8");
55
56
table.vAlign("center").hAlign("center").fontSize(12);
57
58
// set table container and initiate draw
59
table.container(stage).draw();
60
});