Merge pull request #17 from jakob-stoeck/patch-1

show 7 days per week in docs, fixes #12
This commit is contained in:
Prateeksha Singh 2017-11-03 22:42:55 +05:30 committed by GitHub
commit 008d1f376b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 20 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

@ -215,7 +215,7 @@
parent: "#heatmap",
data: heatmap_data, // object with date/timestamp-value pairs
type: 'heatmap',
height: 100,
height: 115,
discrete_domains: 1 // default 0
});</code></pre>
</div>

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];