Remove unused directive files
This commit just removes unused directive files. We should keep our repo clean, and we can pull them from the repo anytime we need. Change-Id: I87e72870a1c4919dd8c8c691b054097decaab60f
This commit is contained in:
parent
567d9d2a24
commit
98616560f1
|
@ -1,80 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var directivesModule = require('./_index.js');
|
||||
|
||||
var d3 = require('d3');
|
||||
var nv = require('nvd3');
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
function chartBar() {
|
||||
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;
|
||||
}
|
||||
var chart = nv.models.discreteBarChart();
|
||||
chart.x(function(d) {
|
||||
return d.label;
|
||||
});
|
||||
chart.y(function(d) {
|
||||
return d.value;
|
||||
});
|
||||
chart.staggerLabels(true);
|
||||
|
||||
if (attrs.showValues) {
|
||||
chart.showValues(angular.fromJson(attrs.showValues));
|
||||
}
|
||||
if (attrs.showXAxis) {
|
||||
chart.showXAxis(angular.fromJson(attrs.showXAxis));
|
||||
}
|
||||
if (attrs.forceY) {
|
||||
chart.forceY(angular.fromJson(attrs.forceY));
|
||||
}
|
||||
if (attrs.tickFormatX) {
|
||||
chart.yAxis.tickFormat(d3.format(attrs.tickFormatX));
|
||||
}
|
||||
if (attrs.tickFormatY) {
|
||||
chart.yAxis.tickFormat(d3.format(attrs.tickFormatY));
|
||||
}
|
||||
|
||||
chart.tooltip.gravity('s').chartContainer(el[0]);
|
||||
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('chartBar', chartBar);
|
|
@ -1,90 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var directivesModule = require('./_index.js');
|
||||
|
||||
var d3 = require('d3');
|
||||
var nv = require('nvd3');
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
function chartGauge() {
|
||||
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.pieChart()
|
||||
.donut(true)
|
||||
.donutRatio(0.4)
|
||||
.showLabels(false)
|
||||
.showLegend(false)
|
||||
.x(function(d) { return d.key; }) // slice label
|
||||
.y(function(d) { return d.value; }) // slice value
|
||||
.color(function(d) { return d.color; });
|
||||
|
||||
chart.pie
|
||||
.startAngle(function(d) { return (d.startAngle / 2) - (Math.PI / 2); })
|
||||
.endAngle(function(d) { return (d.endAngle / 2) - (Math.PI / 2); });
|
||||
|
||||
svg.datum(data).call(chart);
|
||||
|
||||
var passes = data[0].value;
|
||||
var failures = data[1].value;
|
||||
var total = passes + failures;
|
||||
var DEFAULT_FAIL_RATE = 0;
|
||||
var percentOfPasses = (passes / total * 100) || DEFAULT_FAIL_RATE;
|
||||
var percentOfFailures = (failures / total * 100) || DEFAULT_FAIL_RATE;
|
||||
var passesText = 'Passes: ' + percentOfPasses.toFixed(2) + '%';
|
||||
var failuresText = 'Failures: ' + percentOfFailures.toFixed(2) + '%';
|
||||
|
||||
svg.append('text')
|
||||
.attr('x', '50%')
|
||||
.attr('y', '65%')
|
||||
.style('font-size','24px')
|
||||
.attr('text-anchor', 'middle')
|
||||
.text(passesText);
|
||||
svg.append('text')
|
||||
.attr('x', '50%')
|
||||
.attr('y', '80%')
|
||||
.style('font-size','24px')
|
||||
.attr('text-anchor', 'middle')
|
||||
.text(failuresText);
|
||||
|
||||
scope.$on('windowResize', function() {
|
||||
if (chart !== null) {
|
||||
chart.update();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
scope.$watch('data', update);
|
||||
};
|
||||
|
||||
return {
|
||||
restrict: 'EA',
|
||||
scope: {
|
||||
'data': '=',
|
||||
'width': '@',
|
||||
'height': '@'
|
||||
},
|
||||
link: link
|
||||
};
|
||||
}
|
||||
|
||||
directivesModule.directive('chartGauge', chartGauge);
|
Loading…
Reference in New Issue