-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCandleStickChartExample.html
45 lines (37 loc) · 1.22 KB
/
CandleStickChartExample.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
<!DOCTYPE html>
<html>
<head>
<title>d3-ez : Candlestick Chart Example</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="../dist/d3-ez.js"></script>
<link rel="stylesheet" type="text/css" href="../dist/d3-ez.css" />
</head>
<body>
<div id="chartholder"></div>
<br />
<div>Value: <span id="message"></span></div>
<script type="text/javascript">
d3.json("data/bitcoin_price.json").then(function(data) {
// Bitcoin Price Data Source: https://coinmarketcap.com/currencies/bitcoin/historical-data/?start=20180204&end=20180306
// TODO: Convert data to multi-series.
data = [data];
// Create chart base
var myChart = d3.ez.chart.candlestickChart()
.width(1000)
.height(600)
.title("Bitcoin Price")
.subTitle("February - March 2018")
.showLegend(true)
.on("customValueMouseOver", function(e, d) {
d3.select("#message").text(d.open);
})
.on("customSeriesClick", function(e, d) {
console.log(d);
});
d3.select('#chartholder')
.datum(data)
.call(myChart);
});
</script>
</body>
</html>