HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// load data
4
anychart.data.loadCsvFile(
5
'https://gist.githubusercontent.com/awanshrestha/6481638c175e82dc6a91a499a8730057/raw/1791ef1f55f0be268479286284a0452129371003/TSMC.csv',
6
function (data) {
7
8
// create a data table with the loaded data
9
var dataTable = anychart.data.table();
10
dataTable.addData(data);
11
12
// map the loaded data for the candlestick series
13
var mapping = dataTable.mapAs({
14
open: 1,
15
high: 2,
16
low: 3,
17
close: 4
18
});
19
20
// create a stock chart
21
var chart = anychart.stock();
22
23
// create the chart plot
24
var plot = chart.plot(0);
25
26
// set the grid settings
27
plot.yGrid(true).xGrid(true).yMinorGrid(true).xMinorGrid(true);
28
29
// create the candlestick series
30
var series = plot.candlestick(mapping);
31
series.name('TSMC');
32
series.legendItem().iconType('rising-falling');
33
34
// set the title of the chart
35
chart.title('TSMC Stock Chart');
36
37
// set the container id for the chart
38
chart.container('container');
39
40
// initiate the chart drawing
41
chart.draw();
42
}
43
);
44
45
});