[fix] heatmap data and height

This commit is contained in:
pratu16x7 2017-11-03 22:33:07 +05:30
parent dde7991b70
commit f62a1774a4
6 changed files with 16 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -349,25 +349,21 @@ document.querySelector('[data-aggregation="average"]').addEventListener("click",
// Heatmap
// ================================================================================
let heatmap_data = {
1479753000.0: 1,
1498588200.0: 1,
1499193000.0: 1,
1499625000.0: 2,
1500921000.0: 1,
1501612200.0: 1,
1502994600.0: 1,
1503858600.0: 1,
1504809000.0: 3,
1505241000.0: 1,
1506277800.0: 2
};
let heatmap_data = {};
let current_date = new Date();
let timestamp = current_date.getTime()/1000;
timestamp = Math.floor(timestamp - (timestamp % 86400)).toFixed(1); // convert to midnight
for (var i = 0; i< 375; i++) {
heatmap_data[parseInt(timestamp)] = Math.floor(Math.random() * 6);
timestamp = Math.floor(timestamp - 86400).toFixed(1);
}
new Chart({
parent: "#chart-heatmap",
data: heatmap_data,
type: 'heatmap',
height: 100,
height: 115,
discrete_domains: 1 // default 0
});

View File

@ -124,7 +124,8 @@ export default class Heatmap extends BaseChart {
let data_value = 0;
let color_index = 0;
let timestamp = Math.floor(current_date.getTime()/1000).toFixed(1);
let current_timestamp = current_date.getTime()/1000;
let timestamp = Math.floor(current_timestamp - (current_timestamp % 86400)).toFixed(1);
if(this.data[timestamp]) {
data_value = this.data[timestamp];