Created
November 22, 2013 02:44
-
-
Save dylanvee/7593918 to your computer and use it in GitHub Desktop.
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
var limit = 500; | |
$.get("/api/v1/dev/publish_list/" + limit + "?casing=camel").done(function(response) { | |
var statuses = _.chain(response) | |
.map(function(status) { | |
return { | |
timestamp: parseISO8601(status.startTime), | |
successful: status.success | |
} | |
}) | |
.groupBy(function(status) { | |
return moment(status.timestamp).format("YYYY-MM-DD"); | |
}) | |
.map(function(statuses, date) { | |
var counts = _.countBy(statuses, function(status) { | |
return status.successful | |
}); | |
return { | |
date: date, | |
successful: counts[true] || 0, | |
failed: counts[false] || 0 | |
}; | |
}) | |
.reverse() | |
.slice(1) | |
.value(); | |
var successfulSeries = _.pluck(statuses, "successful").join(","), | |
failedSeries = _.pluck(statuses, "failed" ).join(","); | |
var url = "https://chart.googleapis.com/chart?cht=bvs&chxt=x&chs=1000x300&chd=t:" | |
+ successfulSeries + "|" + failedSeries + "&chco=468847,b94a48&chds=a"; | |
console.log(url); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment