Add ability to pick the dates of the logs viewed
This commit is contained in:
parent
7b38482fd9
commit
a3b834cd66
8 changed files with 909 additions and 54 deletions
|
@ -1460,7 +1460,7 @@ LogUsageChart.prototype.handleStateChange_ = function(e) {
|
|||
/**
|
||||
* Draws the chart in the given container element.
|
||||
*/
|
||||
LogUsageChart.prototype.draw = function(container, logData) {
|
||||
LogUsageChart.prototype.draw = function(container, logData, startDate, endDate) {
|
||||
// Reset the container's contents.
|
||||
document.getElementById(container).innerHTML = '<svg></svg>';
|
||||
|
||||
|
@ -1487,12 +1487,12 @@ LogUsageChart.prototype.draw = function(container, logData) {
|
|||
|
||||
chart.multibar.delay(0);
|
||||
|
||||
// Create the x-axis domain to encompass a week from today.
|
||||
// Create the x-axis domain to encompass the full date range.
|
||||
var domain = [];
|
||||
var datetime = new Date();
|
||||
datetime = new Date(datetime.getUTCFullYear(), datetime.getUTCMonth(), datetime.getUTCDate());
|
||||
for (var i = 7; i >= 0; --i) {
|
||||
domain.push(offsetDate(datetime, -1 * i));
|
||||
var datetime = startDate;
|
||||
while (datetime <= endDate) {
|
||||
domain.push(datetime);
|
||||
datetime = offsetDate(datetime, 1);
|
||||
}
|
||||
|
||||
chart.xDomain(domain);
|
||||
|
|
Reference in a new issue