JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js">
</script>
<p>Timestamp: <b id="timestamp">wait...</b>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
// >>> import datetime, calendar
// >>> t=datetime.datetime(2013,11,5,11,30,00)
// >>> calendar.timegm(t.utctimetuple())*1000.0
// 1383651000000.0
var t=1383651000000.0;
$(function () {
$('#container').highcharts({
chart: {
zoomType: 'x'
},
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
type: 'datetime',
events: {
afterSetExtremes: function(event) {
var date = new Date(event.min);
var datevalues = date.getFullYear()
+'-'+ date.getMonth()+1
+'-'+ date.getDate()
+' '+ date.getUTCHours()
+':'+ date.getMinutes()
+':'+ date.getSeconds();
$("#timestamp").text(datevalues);
}
}
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: 'Tokyo',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
pointStart: t,
pointInterval: 1000.0,
}]
});
});
function getTimeStamp(stamp) {
var date = new Date(stamp);
var datevalues =...