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 table
4
var table = anychart.data.table();
5
// add data
6
table.addData([
7
['2015-12-24', 511.53, 514.98, 505.79, 506.40],
8
['2015-12-25', 512.53, 514.88, 505.69, 510.34],
9
['2015-12-26', 511.83, 514.98, 505.59, 507.23],
10
['2015-12-27', 511.22, 515.30, 505.49, 506.47],
11
['2015-12-28', 511.53, 514.98, 505.79, 506.40],
12
['2015-12-29', 512.53, 513.88, 505.69, 510.34],
13
['2015-12-30', 511.83, 512.98, 502.59, 503.23],
14
['2015-12-31', 511.22, 515.30, 505.49, 506.47],
15
['2016-01-01', 510.35, 515.72, 505.23, 508.80]
16
]);
17
18
// map loaded data
19
var mapping = table.mapAs({'open': 1, 'high': 2, 'low': 3, 'close': 4});
20
21
// create a stock chart
22
var chart = anychart.stock();
23
24
// add a series using mappin
25
chart.plot(0).ohlc(mapping).name('ACME Corp. Stock Prices');
26
27
// set container id for the chart
28
chart.container('container');
29
30
// initiate chart drawing
31
chart.draw();
32
});