Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Customer | Year| Week |Failure | name | Type | Count
- ___________________________________________________________________________
- A 2018 29 N Express Air PASSENGER 27
- ___________________________________________________________________________
- A 2018 26 N Express Air PASSENGER 58
- ___________________________________________________________________________
- A 2018 26 Delay hours Express Air 5
- ___________________________________________________________________________
- A 2018 27 N Express Air HIGH SPEED 29
- ___________________________________________________________________________
- A 2018 30 Maintenance missed Express Air PASSENGER 11
- ___________________________________________________________________________
- A 2018 32 N Express Air PASSENGER 53
- ___________________________________________________________________________
- A 2018 25 N Express Air 2
- ___________________________________________________________________________
- A 2018 33 N Express Air HIGH SPEED 3
- ____________________________________________________________________________
- A 2018 31 Bogey Missing Express Air PASSENGER 1
- var ndx= crossfilter(data);
- var all= ndx.groupAll();
- var countType = ndx.dimension(function (d) { return d["count"]; });
- dataTable.width(800).height(800)
- .dimension(countType)
- .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.failure_reason; },
- function(d) { return d.name; },
- function(d) { return d.train_type; },
- function(d) { return d.count; }
- ])
- .sortBy(function(d){ return d.count; })
- // (optional) sort order, :default ascending
- .order(d3.descending);
- var total = countType.group().reduceSum(function(d) {return
- d["count"];})
- dc.numberDisplay("#total")
- .valueAccessor(function(d){return +d.value})
- .group(total);
- var total = countType.groupAll().reduceSum(function(d) {return
- d["count"];})
- dc.numberDisplay("#total")
- .valueAccessor(function(d){return d})
- .group(total);
- var failureGroup= failureType.group().reduceSum(function(d) {return
- d.count;});
- var failureType = ndx.dimension(function(d) { return
- d["failure_reason"]; });
- function choose_bin(group, key) {
- return {
- value: function() {
- return group.all().filter(kv => kv.key === key)[0].value;
- }
- }
- }
- var allCount = failureType.groupAll().reduceSum(d => d.count);
- var nofailure = choose_bin(failureGroup, 'N');
- dc.numberDisplay("#total1")
- .group(nofailure)
- .valueAccessor(x => (x / allCount.value())*100);
Add Comment
Please, Sign In to add comment