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
// map loaded data
9
var mapping = dataTable.mapAs({"high": 1, "low": 3, "close": 4, "volume": 5, "value": 4});
10
11
// create stock chart
12
var chart = anychart.stock();
13
14
// create plot on the chart
15
var plot0 = chart.plot(0);
16
var plot1 = chart.plot(1);
17
18
// create line series
19
var splineSeries = plot0.spline(mapping);
20
splineSeries.name("CSCO");
21
splineSeries.stroke("2px #64b5f6");
22
23
// create CHO indicator
24
cho = plot1.cho(mapping);
25
choSeries = cho.series();
26
choSeries.stroke("#bf360c");
27
28
// set container id for the chart
29
chart.container("container");
30
31
// initiate chart drawing
32
chart.draw();
33
});