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
5
// create data table on loaded data
6
var dataTable = anychart.data.table();
7
dataTable.addData(get_csco_daily_data());
8
9
// map loaded data
10
var mapping = dataTable.mapAs({"open": 1, "high": 2, "low": 3, "close": 4});
11
12
// create a stock chart
13
var chart = anychart.stock();
14
15
// create the first plot on the chart
16
var plot_0 = chart.plot(0);
17
18
// create an ohlc series
19
plot_0.ohlc(mapping).name('CSCO');
20
21
// create the second plot on the chart
22
var plot_1 = chart.plot(1);
23
24
// create and adjust a PPO indicator
25
var ppo_1 = plot_1.ppo(mapping);
26
27
// create the third plot on the chart
28
var plot_2 = chart.plot(2);
29
30
// create and adjust a PPO indicator
31
var ppo_2 = plot_2.ppo(mapping);
32
33
ppo_2.ppoSeries().stroke("0.5 red");
34
ppo_2.signalSeries().stroke("0.5 red");
35
ppo_2.histogramSeries().seriesType("line");
36
37
// set container id for the chart
38
chart.container('container');
39
40
// initiate chart drawing
41
chart.draw();
42
});