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
table = anychart.data.table();
4
table.addData([
5
['2015-12-25', 512.53, 514.88, 505.69, 507.34],
6
['2015-12-26', 511.83, 514.98, 505.59, 506.23],
7
['2015-12-27', 511.22, 515.30, 505.49, 506.47],
8
['2015-12-28', 510.35, 515.72, 505.23, 505.80],
9
['2015-12-29', 510.53, 515.86, 505.38, 508.25],
10
['2015-12-30', 511.43, 515.98, 505.66, 507.45],
11
['2015-12-31', 511.50, 515.33, 505.99, 507.98],
12
['2016-01-01', 511.32, 514.29, 505.99, 506.37],
13
['2016-01-02', 511.70, 514.87, 506.18, 506.75],
14
['2016-01-03', 512.30, 514.78, 505.87, 508.67],
15
['2016-01-04', 512.50, 514.77, 505.83, 508.35],
16
['2016-01-05', 511.53, 516.18, 505.91, 509.42],
17
['2016-01-06', 511.13, 516.01, 506.00, 509.26],
18
['2016-01-07', 510.93, 516.07, 506.00, 510.99],
19
['2016-01-08', 510.88, 515.93, 505.22, 509.95],
20
['2016-01-09', 509.12, 515.97, 505.15, 510.12],
21
['2016-01-10', 508.53, 516.13, 505.66, 510.42],
22
['2016-01-11', 511.53, 516.18, 505.91, 509.42],
23
['2016-01-12', 510.35, 515.72, 505.23, 505.80],
24
['2016-01-13', 510.53, 515.86, 505.38, 508.25],
25
['2016-01-14', 511.43, 515.98, 505.66, 507.45],
26
['2016-01-15', 511.50, 515.33, 505.99, 507.98],
27
['2016-01-16', 511.32, 514.29, 505.99, 506.37],
28
['2016-01-17', 511.70, 514.87, 506.18, 506.75],
29
['2016-01-18', 512.30, 514.78, 505.87, 508.67],
30
['2016-01-19', 512.50, 514.77, 505.83, 508.35],
31
['2016-01-20', 511.53, 516.18, 505.91, 509.42],
32
['2016-01-21', 511.13, 516.01, 506.00, 509.26],
33
['2016-01-22', 510.93, 516.07, 506.00, 510.99]
34
]);
35
36
// mapping the data
37
mapping = table.mapAs();
38
mapping.addField('open', 1, 'first');
39
mapping.addField('high', 2, 'max');
40
mapping.addField('low', 3, 'min');
41
mapping.addField('close', 4, 'last');
42
mapping.addField('value', 4, 'last');
43
44
// defining the chart type
45
var chart = anychart.stock();
46
47
// create series
48
var ohlcSeries = chart.plot(0).ohlc(mapping);
49
ohlcSeries.name('ACME Corp.');
50
51
// setting the chart title
52
chart.title('AnyStock Demo');
53
54
chart.container('container');
55
chart.draw();
56
});