Last active
January 29, 2020 00:44
-
-
Save noherczeg/663dc34160e78f32c7b7f5906d07f5b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<title>HighCharts demo</title> | |
<script src="https://code.highcharts.com/stock/highstock.js"></script> | |
<script src="http://code.highcharts.com/maps/modules/map.js"></script> | |
</head> | |
<body> | |
<div id="container" style="height: 400px; min-width: 310px"></div> | |
<script type="text/javascript"> | |
fetch('./aapl-c.json') | |
.then(res => res.json()) | |
.then(data => { | |
Highcharts.stockChart('container', { | |
mapNavigation: { | |
enableMouseWheelZoom: true, | |
}, | |
rangeSelector: { | |
selected: 1, | |
inputEnabled: false, | |
buttons: [{ | |
type: 'w', | |
count: 1, | |
text: '1W', | |
}, { | |
type: 'month', | |
count: 1, | |
text: '1M', | |
}, { | |
type: 'month', | |
count: 6, | |
text: '6M', | |
}, { | |
type: 'year', | |
count: 1, | |
text: '1Y', | |
}, { | |
type: 'year', | |
count: 3, | |
text: '3Y', | |
}, { | |
type: 'year', | |
count: 5, | |
text: '5Y', | |
}, { | |
type: 'ytd', | |
text: 'YTD', | |
}, { | |
type: 'all', | |
text: 'Inception', | |
}], | |
labelStyle: { | |
display: 'none', | |
}, | |
buttonTheme: { | |
width: 60 | |
}, | |
}, | |
legend: { | |
enabled: true, | |
}, | |
title: { | |
text: 'AAPL Stock Price', | |
}, | |
navigator: { | |
enabled: false, | |
}, | |
credits: { | |
enabled: false, | |
}, | |
plotOptions: { | |
line : { | |
tooltip : { | |
enabled : true, | |
}, | |
}, | |
}, | |
chart: { | |
events: { | |
load: function() { | |
const { points } = this.series[0]; | |
var p = points[points.length - 1]; | |
this.tooltip.refresh(p); | |
} | |
} | |
}, | |
series: [{ | |
animation: false, | |
name: 'AAPL', | |
data: data, | |
color: '#71b783', | |
tooltip: { | |
valueDecimals: 2, | |
}, | |
stickyTracking: true, | |
}], | |
tooltip: { | |
shadow: false, | |
borderWidth: 0, | |
positioner: function () { | |
return { | |
x: 10, | |
y: 10 | |
}; | |
} | |
}, | |
yAxis: { | |
opposite: true, | |
crosshair: { | |
label: { | |
enabled: true, | |
format: '{value:.2f}', | |
}, | |
}, | |
}, | |
xAxis: { | |
type: 'datetime', | |
crosshair: { | |
label: { | |
enabled: true, | |
padding: 8, | |
}, | |
}, | |
gridLineWidth: 1, | |
}, | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment