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 stock chart
13
var chart = anychart.stock();
14
15
// create a plot on the chart
16
var plot = chart.plot();
17
18
// create ohlc series
19
var ohlcSeries = plot.ohlc(mapping);
20
ohlcSeries.name("CSCO");
21
22
// create a Price Channels indicator
23
var priceChannels = plot.priceChannels(mapping);
24
25
// create scroller series with mapped data
26
chart.scroller().line(mapping);
27
28
// set container id for the chart
29
chart.container("container");
30
31
// initiate chart drawing
32
chart.draw();
33
});