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
['1790-01-01', 3929],
7
['1795-01-01', 4390],
8
['1800-01-01', 5236],
9
['1805-01-01', 5989],
10
['1810-01-01', 7239],
11
['1815-01-01', 8722],
12
['1820-01-01', 9638],
13
['1825-01-01', 10923],
14
['1830-01-01', 12866],
15
['1835-01-01', 15454],
16
['1840-01-01', 17069],
17
['1845-01-01', 19234],
18
['1850-01-01', 23191],
19
['1855-01-01', 28347],
20
['1860-01-01', 31443],
21
['1865-01-01', 34098],
22
['1870-01-01', 38558],
23
['1875-01-01', 44728],
24
['1880-01-01', 49371],
25
['1885-01-01', 53989],
26
['1890-01-01', 62979],
27
['1895-01-01', 71883],
28
['1900-01-01', 76212],
29
['1905-01-01', 85023],
30
['1910-01-01', 92228],
31
['1915-01-01', 100378],
32
['1920-01-01', 106021],
33
['1925-01-01', 118323],
34
['1930-01-01', 123202],
35
['1935-01-01', 126232],
36
['1940-01-01', 132164],
37
['1945-01-01', 144773],
38
['1950-01-01', 151325],
39
['1955-01-01', 160460],
40
['1960-01-01', 179323],
41
['1965-01-01', 188232],
42
['1970-01-01', 203211],
43
['1975-01-01', 215789],
44
['1980-01-01', 226545],
45
['1985-01-01', 239905],
46
['1990-01-01', 248709],
47
['1995-01-01', 272119],
48
['2000-01-01', 281421],
49
['2005-01-01', 299456],
50
['2010-01-01', 308745],
51
['2015-01-01', 318914]
52
]);
53
54
// map the data
55
mapping = table.mapAs();
56
mapping.addField('value', 1);
57
58
// chart type
59
var chart = anychart.stock();
60
61
// set the series
62
var series = chart.plot(0).marker(mapping);
63
series.name("USA");
64
65
chart.title('Stock Marker Demo: population growth \n(Array data notation)');
66
chart.container('container');
67
68
chart.draw();
69
});