Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Customer | Year| Week |Failure_Reason| name | Type | Count
- ___________________________________________________________________________
- A 2018 29 Delay hours Express Air PASSENGER 27
- ___________________________________________________________________________
- A 2018 26 Maintenance missed Express Air PASSENGER 58
- ___________________________________________________________________________
- A 2018 26 Delay hours Domestic 5
- ___________________________________________________________________________
- A 2018 27 N Domestic HIGH SPEED 29
- ___________________________________________________________________________
- A 2018 30 Maintenance missed International PASSENGER 11
- ___________________________________________________________________________
- A 2018 32 N Domestic PASSENGER 53
- var ndx= crossfilter(data);
- var all= ndx.groupAll();
- var CTypedim=ndx.dimension(function(d) {return d["name"];})
- var CTypeGroup=CTypedim.group();
- var weekFailures = CTypedim.group().reduce(
- function(p, v) {
- p.counter+= Number(v.count);
- p.failures += Number(v.Failure_Reason != 'N' ? v.count : 0);
- p.failPercent = p.counter ? p.failures/p.counter : 0;
- return p;
- },
- function(p, v) {
- p.counter-= Number(v.count);
- p.failures -= Number(v.Failure_Reason != 'N' ? v.count : 0);
- p.failPercent = p.counter ? p.failures/p.counter : 0;
- return p;
- },
- function() {
- return {
- counter: 0,
- failures: 0,
- failPercent: 0
- };
- });
- dataTable.width(800).height(800)
- .dimension(CTypedim)
- .group(function(d) { return "" })
- .size(100)
- .columns([
- function(d) { return d.alias; },
- function(d) { return d.y; },
- function(d) { return d.w; },
- function(d) { return d.failpercent*100; },
- function(d) { return d.name; },
- ])
- .sortBy(function(d){ return d.count; })
- // (optional) sort order, :default ascending
- .order(d3.descending);
- Customer | Year| Failure%| name |
- _____________________________________________
- A 2018 100% Express Air
- _____________________________________________
- A 2018 5.7% Domestic
- _____________________________________________
- A 2018 100% International
- _____________________________________________
Add Comment
Please, Sign In to add comment