Skip to content

Instantly share code, notes, and snippets.

@manifoldhiker
Created May 24, 2018 14:52
Show Gist options
  • Save manifoldhiker/25a9871a3531dc999d6aab0a4b8f309a to your computer and use it in GitHub Desktop.
Save manifoldhiker/25a9871a3531dc999d6aab0a4b8f309a to your computer and use it in GitHub Desktop.
<html>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>
<script>
$.getJSON('http://localhost:56194/api/temperature/current', function(data){
console.log(data)
})
$.getJSON('http://localhost:56194/api/temperature/all', function (data) {
// Create the chart
debugger
let models = data.map(mapData);
console.log(models);
Highcharts.stockChart('container', {
rangeSelector: {
selected: 1
},
title: {
text: 'My temperature'
},
series: [{
name: 'AAPL',
data: models,
tooltip: {
valueDecimals: 2
}
}]
});
});
function mapData (model) {
return [12, model.value]
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment