Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
graph with number of assertions over time
- Loading branch information
Showing
5 changed files
with
2,671 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,55 @@ | |||
- content_for :head do | |||
= javascript_include_tag "jquery.flot" | |||
|
|||
%h2 Stats | |||
|
|||
%h3 Last 100 commits | |||
|
|||
%h4 Number of assertions | |||
|
|||
#choices{:style => "float: right;"} | |||
#placeholder{ :style => "width:600px;height:300px;"} | |||
|
|||
|
|||
:javascript | |||
$(function () { | |||
|
|||
var datasets = #{@assertions.to_json}; | |||
// hard-code color indices to prevent them from shifting as | |||
// countries are turned on/off | |||
var i = 0; | |||
$.each(datasets, function(key, val) { | |||
val.color = i; | |||
++i; | |||
}); | |||
|
|||
// insert checkboxes | |||
var choiceContainer = $("#choices"); | |||
$.each(datasets, function(key, val) { | |||
choiceContainer.append('<br/><input type="checkbox" name="' + key + | |||
'" checked="checked" id="id' + key + '">' + | |||
'<label for="id' + key + '">' | |||
+ val.label + '</label>'); | |||
}); | |||
choiceContainer.find("input").click(plotAccordingToChoices); | |||
|
|||
|
|||
function plotAccordingToChoices() { | |||
var data = []; | |||
|
|||
choiceContainer.find("input:checked").each(function () { | |||
var key = $(this).attr("name"); | |||
if (key && datasets[key]) | |||
data.push(datasets[key]); | |||
}); | |||
|
|||
if (data.length > 0) | |||
$.plot($("#placeholder"), data, { | |||
yaxis: { min: 0 }, | |||
xaxis: { tickDecimals: 0 } | |||
}); | |||
} | |||
|
|||
plotAccordingToChoices(); | |||
}); | |||
|
Oops, something went wrong.