-
Notifications
You must be signed in to change notification settings - Fork 17.2k
Added Calendar Heatmap #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
57a3406
Added sqlite Grains
638617e
Calendar heatmap visualization
de308ea
Linting
georgeke 03b62c0
Explicit metric setting was breaking tests
georgeke c76b6f9
Python linting
georgeke 17820e7
Code cleanup + review
georgeke 68df338
[fixing the build] a new version of eslint is more picky
mistercrunch 54afb47
Linting
georgeke 0472061
Added sqlite Grains
defed82
Calendar heatmap visualization
3dacc8b
Linting
georgeke ffbe06a
Explicit metric setting was breaking tests
georgeke 627d611
Python linting
georgeke c075a1a
Code cleanup + review
georgeke ed860ad
Linting
georgeke 84281a9
Merge branch 'master' into master
georgeke 0ee9ea7
Merge branch 'master' of github.com:georgeke/caravel
georgeke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n