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
// The data used in this sample can be obtained from the CDN
3
// https://cdn.anychart.com/csv-data/csco-daily.js
4
// create data table on loaded data
5
var dataTable = anychart.data.table();
6
dataTable.addData(get_csco_daily_data());
7
8
var mapping = dataTable.mapAs({
9
'open': 1,
10
'high': 2,
11
'low': 3,
12
'close': 4,
13
'value': {column: 4, type: 'close'}
14
});
15
16
// create stock chart
17
var chart = anychart.stock();
18
19
// create plot on the chart
20
var plot = chart.plot(0);
21
22
// create line series
23
plot.ohlc(mapping).name('CSCO');
24
25
// create and adjust an Awesome Oscillator indicator
26
var ao_1 = chart.plot(1).ao(mapping).series();
27
ao_1.risingStroke("#33ccff");
28
ao_1.fallingStroke("#ff33cc");
29
30
// create and adjust an Awesome Oscillator indicator
31
var ao_2 = chart.plot(2).ao(mapping, 15, 44, "sma", "area").series();
32
ao_2.risingStroke(null);
33
ao_2.fallingStroke(null);
34
ao_2.risingFill("#37474f");
35
ao_2.fallingFill("#90a4ae");
36
37
// create scroller series with mapped data
38
chart.scroller().line(mapping);
39
40
// set container id for the chart
41
chart.container('container');
42
43
// initiate chart drawing
44
chart.draw();
45
});