Repository navigation
Expand file tree
/
Copy pathchart.html
More file actions
96 lines (75 loc) · 2.35 KB
/
Copy pathchart.html
File metadata and controls
96 lines (75 loc) · 2.35 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
layout: None
---
<html>
<head>
<meta charset="utf-8" />
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<script type='text/javascript'>//<![CDATA[
$(function() {
var symbol = window.location.search.substring(1);
symbol=symbol.replace("s=",""); // removes s=
var crypto_currency = symbol.substr(0, 3);
var currency = symbol.substr(3);
$.getJSON('/api/v1/'+ currency +'/trades?crypto_currency=' + crypto_currency, function(data) {
var prices = [],
volume = [];
$.each(data, function( index, value ) {
var date = value.date*1000;
prices.unshift([date, value.price]);
volume.unshift([date, value.amount]);
});
$('#container').highcharts('StockChart', {
rangeSelector : {
selected : 1,
inputEnabled: true
},
yAxis: [{
labels: {
align: 'right',
x: -3
},
title: {
text: 'Price'
},
height: '60%',
lineWidth: 2
}, {
labels: {
align: 'right',
x: -3
},
title: {
text: 'Volume'
},
top: '65%',
height: '35%',
offset: 0,
lineWidth: 2
}],
series : [{
name : symbol,
data : prices,
tooltip: {
valueDecimals: 2
}
},
{
name : 'Volume',
type: 'column',
data : volume,
yAxis: 1
}
]
});
});
});
//]]>
</script>
</head>
<body>
<div id="container" style="height: 400px; min-width: 310px"></div>
</body>
</html>