74 lines
2.1 KiB
HTML
Executable File
74 lines
2.1 KiB
HTML
Executable File
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<script type="text/javascript" src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script>
|
|
<script type="text/javascript" src="../../canvasjs.stock.min.js"></script>
|
|
<script type="text/javascript">
|
|
window.onload = function () {
|
|
var dataPoints1 = [], dataPoints2 = [];
|
|
var stockChart = new CanvasJS.StockChart("chartContainer",{
|
|
theme: "light2",
|
|
animationEnabled: true,
|
|
title:{
|
|
text:"Multi-Series StockChart with Navigator"
|
|
},
|
|
subtitles: [{
|
|
text: "No of Trades: BTC/USD vs BTC/EUR"
|
|
}],
|
|
charts: [{
|
|
axisY: {
|
|
title: "No of Trades"
|
|
},
|
|
toolTip: {
|
|
shared: true
|
|
},
|
|
legend: {
|
|
cursor: "pointer",
|
|
itemclick: function (e) {
|
|
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible)
|
|
e.dataSeries.visible = false;
|
|
else
|
|
e.dataSeries.visible = true;
|
|
e.chart.render();
|
|
}
|
|
},
|
|
data: [{
|
|
showInLegend: true,
|
|
name: "No of Trades in $",
|
|
yValueFormatString: "#,##0",
|
|
xValueType: "dateTime",
|
|
dataPoints : dataPoints1
|
|
},{
|
|
showInLegend: true,
|
|
name: "No of Trades in €",
|
|
yValueFormatString: "#,##0",
|
|
dataPoints : dataPoints2
|
|
}]
|
|
}],
|
|
rangeSelector: {
|
|
enabled: false
|
|
},
|
|
navigator: {
|
|
data: [{
|
|
dataPoints: dataPoints1
|
|
}],
|
|
slider: {
|
|
minimum: new Date(2018, 00, 15),
|
|
maximum: new Date(2018, 02, 01)
|
|
}
|
|
}
|
|
});
|
|
$.getJSON("https://canvasjs.com/data/docs/btcvolume2018.json", function(data) {
|
|
for(var i = 0; i < data.length; i++){
|
|
dataPoints1.push({x: new Date(data[i].date), y: Number(data[i].volume_btc_usd)});
|
|
dataPoints2.push({x: new Date(data[i].date), y: Number(data[i].volume_btc_eur)});
|
|
}
|
|
stockChart.render();
|
|
});
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="chartContainer" style="height: 400px; max-width: 920px; margin: 0px auto;"></div>
|
|
</body>
|
|
</html> |