adb7dd311f
This adds a new page for a single test's details. It displays a runtime graph and a stacked area graph of test statuses for the specified individual test across all runs over the past 30 days. Change-Id: Ib1f5aaaaf49315e2b00d38407e07702922f3d96f
67 lines
1.4 KiB
JavaScript
67 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
var directivesModule = require('./_index.js');
|
|
|
|
var d3 = require('d3');
|
|
var nv = require('nvd3');
|
|
|
|
/**
|
|
* @ngInject
|
|
*/
|
|
function chartStackArea() {
|
|
var link = function(scope, el, attrs) {
|
|
scope.$on("loading-started", function() {
|
|
el.css({"display" : "none"});
|
|
});
|
|
|
|
scope.$on("loading-complete", function() {
|
|
el.css({"display" : "block"});
|
|
});
|
|
|
|
var chart = null;
|
|
|
|
var svg = d3.select(el[0]).append('svg')
|
|
.attr('width', attrs.width)
|
|
.attr('height', attrs.height);
|
|
|
|
var update = function(data) {
|
|
if (typeof data === "undefined") {
|
|
return;
|
|
}
|
|
chart = nv.models.stackedAreaChart()
|
|
.margin({right: 100})
|
|
.x(function(d) { return d.x; })
|
|
.y(function(d) { return d.y; })
|
|
.useInteractiveGuideline(true)
|
|
.rightAlignYAxis(true)
|
|
.showControls(true)
|
|
.clipEdge(true);
|
|
|
|
chart.xAxis.tickFormat(function(d) { return d3.time.format("%x")(new Date(d)); });
|
|
|
|
chart.yAxis.tickFormat(d3.format(',.2f'));
|
|
svg.datum(data).call(chart);
|
|
};
|
|
|
|
scope.$on('windowResize', function() {
|
|
if (chart !== null) {
|
|
chart.update();
|
|
}
|
|
});
|
|
|
|
scope.$watch('data', update);
|
|
};
|
|
|
|
return {
|
|
restrict: 'EA',
|
|
scope: {
|
|
'data': '=',
|
|
'width': '@',
|
|
'height': '@'
|
|
},
|
|
link: link
|
|
};
|
|
}
|
|
|
|
directivesModule.directive('chartStackArea', chartStackArea);
|