Guest User

Untitled

a guest
Oct 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. Customer | Year| Week |Failure_Reason| name | Type | Count
  2. ___________________________________________________________________________
  3. A 2018 29 Delay hours Express Air PASSENGER 27
  4. ___________________________________________________________________________
  5. A 2018 26 Maintenance missed Express Air PASSENGER 58
  6. ___________________________________________________________________________
  7. A 2018 26 Delay hours Domestic 5
  8. ___________________________________________________________________________
  9. A 2018 27 N Domestic HIGH SPEED 29
  10. ___________________________________________________________________________
  11. A 2018 30 Maintenance missed International PASSENGER 11
  12. ___________________________________________________________________________
  13. A 2018 32 N Domestic PASSENGER 53
  14.  
  15. var ndx= crossfilter(data);
  16. var all= ndx.groupAll();
  17. var CTypedim=ndx.dimension(function(d) {return d["name"];})
  18. var CTypeGroup=CTypedim.group();
  19.  
  20. var weekFailures = CTypedim.group().reduce(
  21. function(p, v) {
  22. p.counter+= Number(v.count);
  23. p.failures += Number(v.Failure_Reason != 'N' ? v.count : 0);
  24. p.failPercent = p.counter ? p.failures/p.counter : 0;
  25. return p;
  26. },
  27. function(p, v) {
  28.  
  29. p.counter-= Number(v.count);
  30. p.failures -= Number(v.Failure_Reason != 'N' ? v.count : 0);
  31. p.failPercent = p.counter ? p.failures/p.counter : 0;
  32. return p;
  33. },
  34. function() {
  35. return {
  36. counter: 0,
  37. failures: 0,
  38. failPercent: 0
  39. };
  40. });
  41.  
  42. dataTable.width(800).height(800)
  43. .dimension(CTypedim)
  44. .group(function(d) { return "" })
  45. .size(100)
  46. .columns([
  47. function(d) { return d.alias; },
  48. function(d) { return d.y; },
  49. function(d) { return d.w; },
  50. function(d) { return d.failpercent*100; },
  51. function(d) { return d.name; },
  52.  
  53. ])
  54. .sortBy(function(d){ return d.count; })
  55. // (optional) sort order, :default ascending
  56. .order(d3.descending);
  57.  
  58. Customer | Year| Failure%| name |
  59. _____________________________________________
  60. A 2018 100% Express Air
  61. _____________________________________________
  62. A 2018 5.7% Domestic
  63. _____________________________________________
  64. A 2018 100% International
  65. _____________________________________________
Add Comment
Please, Sign In to add comment