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
// set the data
4
table = anychart.data.table();
5
table.addData([
6
['2004-01-02', 29, 1217],
7
['2004-01-05', 38, 3885],
8
['2004-01-06', 43, 992],
9
['2004-01-07', 48, 1753],
10
['2004-01-08', 61, 2493],
11
['2004-01-09', 68, 5672],
12
['2004-01-12', 52, 7284],
13
['2004-01-13', 56, 2737],
14
['2004-01-14', 42, 8338],
15
['2004-01-15', 46, 4829],
16
['2004-01-16', 91, 7532],
17
['2004-01-20', 62, 10387],
18
['2004-01-21', 54, 3832],
19
['2004-01-22', 43, 9248],
20
['2004-01-23', 59, 2487],
21
['2004-01-26', 42, 2498],
22
['2004-01-27', 49, 7564],
23
['2004-01-28', 49, 5764],
24
['2004-01-29', 86, 3549],
25
['2004-01-30', 71, 7365],
26
['2004-02-02', 81, 2985],
27
['2004-02-03', 81, 3573],
28
['2004-02-04', 90, 9834],
29
['2004-02-05', 10, 3453],
30
['2004-02-06', 74, 7843],
31
['2004-02-09', 52, 3820],
32
['2004-02-10', 39, 2374],
33
['2004-02-11', 87, 9458],
34
['2004-02-12', 48, 8237],
35
['2004-02-13', 43, 9283],
36
['2004-02-17', 37, 2234]
37
]);
38
39
40
// map the data
41
mapping_total = table.mapAs();
42
mapping_total.addField('value', 1);
43
mapping_region = table.mapAs();
44
mapping_region.addField('value', 2);
45
46
// chart type
47
var chart = anychart.stock();
48
49
// set the series
50
var series_total = chart.plot(0).stick(mapping_total);
51
series_total.name("Total Request number");
52
var series_region = chart.plot(1).stick(mapping_region);
53
series_region.name("Region Request Number");
54
55
chart.title('Stock Stick Demo');
56
57
chart.container('container');
58
chart.draw();
59
});