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
var dataTable = anychart.data.table();
3
4
// The data used in this sample can be obtained from the CDN
5
// https://cdn.anychart.com/csv-data/dji-daily-short.js
6
dataTable.addData(get_dji_daily_short_data());
7
8
var mapping = dataTable.mapAs();
9
mapping.addField('high', 2, 'max');
10
mapping.addField('low', 3, 'min');
11
12
var chart = anychart.stock();
13
14
// Create computer.
15
var computer = dataTable.createComputer(mapping);
16
17
var context = anychart.math.aroonOscillator.initContext(10);
18
19
// Set init context.
20
computer.setContext(context);
21
22
// Set start calculation function.
23
computer.setStartFunction(anychart.math.aroonOscillator.startFunction);
24
25
// Calculation function.
26
computer.setCalculationFunction(anychart.math.aroonOscillator.calculationFunction);
27
28
computer.addOutputField('result');
29
30
var plot = chart.plot();
31
plot.line(dataTable, {value: computer.getFieldIndex('result')}).name('Aroon Oscillator');
32
33
chart.container('container');
34
chart.draw();
35
});