-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added sqlite Grains * Calendar heatmap visualization * Linting * Explicit metric setting was breaking tests * Python linting * Code cleanup + review * [fixing the build] a new version of eslint is more picky * Linting * Added sqlite Grains * Calendar heatmap visualization * Linting * Linting * Explicit metric setting was breaking tests * Python linting * Code cleanup + review
- Loading branch information
1 parent
607e1f9
commit 5c0e30e
Showing
11 changed files
with
215 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.cal_heatmap .slice_container { | ||
padding: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// JS | ||
var d3 = window.d3 || require('d3'); | ||
|
||
// CSS | ||
require('./cal_heatmap.css'); | ||
require('../node_modules/cal-heatmap/cal-heatmap.css'); | ||
|
||
var CalHeatMap = require('cal-heatmap'); | ||
|
||
function calHeatmap(slice) { | ||
|
||
var div = d3.select(slice.selector); | ||
var cal = new CalHeatMap(); | ||
|
||
var render = function () { | ||
d3.json(slice.jsonEndpoint(), function (error, json) { | ||
|
||
if (error !== null) { | ||
slice.error(error.responseText); | ||
return ''; | ||
} | ||
|
||
div.selectAll("*").remove(); | ||
cal = new CalHeatMap(); | ||
|
||
var timestamps = json.data["timestamps"], | ||
extents = d3.extent(Object.keys(timestamps), function (key) { | ||
return timestamps[key]; | ||
}), | ||
step = (extents[1] - extents[0]) / 5; | ||
|
||
try { | ||
cal.init({ | ||
start: json.data["start"], | ||
data: timestamps, | ||
itemSelector: slice.selector, | ||
tooltip: true, | ||
domain: json.data["domain"], | ||
subDomain: json.data["subdomain"], | ||
range: json.data["range"], | ||
browsing: true, | ||
legend: [extents[0], extents[0]+step, extents[0]+step*2, extents[0]+step*3] | ||
}); | ||
} catch (e) { | ||
slice.error(e); | ||
} | ||
|
||
slice.done(json); | ||
}); | ||
}; | ||
|
||
return { | ||
render: render, | ||
resize: render | ||
}; | ||
} | ||
|
||
module.exports = calHeatmap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters