-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
60 lines (54 loc) · 1.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name="author" content="AnyChart">
<title>AnyChart</title>
<!--AnyChart modules-->
<script src="https://cdn.anychart.com/releases/v8/js/anychart-core.min.js"></script>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-stock.min.js"></script>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-ui.min.js"></script>
<script src="https://cdn.anychart.com/releases/v8/js/anychart-exports.min.js"></script>
<link href="https://cdn.anychart.com/releases/v8/css/anychart-ui.min.css" rel="stylesheet" type="text/css">
<link href="https://cdn.anychart.com/releases/v8/fonts/css/anychart-font.css" rel="stylesheet" type="text/css">
<style>
html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="container"></div>
<script>
anychart.onDocumentReady(function () {
// create data table on loaded data
// date field defines what field in receiving JSON data provides dateTime
var dataTable = anychart.data.table('date');
dataTable.addData('{{data}}');
// map loaded data
// fields' string names are equal to receiving JSON data fields
var mapping = dataTable.mapAs({
open: 'open',
high: 'high',
low: 'low',
close: 'close'
});
// create stock chart
var chart = anychart.stock();
// create plot on the chart
var plot = chart.plot(0);
// create candlestick series on the plot
var series = plot.candlestick(mapping);
// set series settings
series.name('AAPL.US');
// set chart title
chart.title('Stock chart based on Historical Data Feed');
// set container id for the chart and initiate chart drawing
chart.container('container').draw();
});
</script>
</body>
</html>