HTMLcopy
1
<div id="container"></div>
CSScopy
7
1
html, body, #container
2
{
3
width: 100%;
4
height: 100%;
5
margin: 0;
6
padding: 0;
7
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// load data
4
anychart.data.loadCsvFile("https://static.anychart.com/git-storage/word-press/data/candlestick-chart-tutorial/EUR_USDHistoricalData2year.csv", function (data) {
5
6
// create a data table
7
var dataTable = anychart.data.table(0, 'MMM d, yyyy');
8
dataTable.addData(data);
9
10
// map data
11
var mapping = dataTable.mapAs({ 'open': 2, 'high': 3, 'low': 4, 'close': 1 });
12
13
// set the chart type
14
var chart = anychart.stock();
15
16
// set the series
17
var series = chart.plot(0).candlestick(mapping);
18
series.name("EUR USD Trade Data");
19
20
// set the chart title
21
chart.title("EUR USD Historical Trade Data");
22
23
// set the container id
24
chart.container('container');
25
26
// draw the chart
27
chart.draw();
28
29
});
30
31
});