-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchart.js
More file actions
29 lines (27 loc) · 767 Bytes
/
Copy pathchart.js
File metadata and controls
29 lines (27 loc) · 767 Bytes
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
var chartData = [];
var chartLabels = [];
_temperatureReadings.reverse();
for (var i = 0, len = _temperatureReadings.length; i < len; i++) {
chartLabels.push(moment.utc(_temperatureReadings[i]['CreatedOn']).local().format('MM-DD-YYYY h:mm:ss a'));
chartData.push(Math.round(_temperatureReadings[i]['Celsius'] * 1.8 + 32));
}
var ctx = document.getElementById('tempChart');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: chartLabels,
datasets: [{
label: _temperatureReadings[0]['SensorId'],
data: chartData,
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});