graph-config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. 'use strict';
  2. angular.module('etcd.ui').value('graphConfig', {
  3. 'padding': {'top': 10, 'left': 5, 'bottom': 40, 'right': 10},
  4. 'data': [
  5. {
  6. 'name': 'stats'
  7. },
  8. {
  9. 'name': 'thresholds',
  10. 'values': [50, 100]
  11. }
  12. ],
  13. 'scales': [
  14. {
  15. 'name': 'y',
  16. 'type': 'ordinal',
  17. 'range': 'height',
  18. 'domain': {'data': 'stats', 'field': 'index'}
  19. },
  20. {
  21. 'name': 'x',
  22. 'range': 'width',
  23. 'domainMin': 0,
  24. 'domainMax': 100,
  25. 'nice': true,
  26. 'zero': true,
  27. 'domain': {'data': 'stats', 'field': 'data.latency.current'}
  28. },
  29. {
  30. 'name': 'color',
  31. 'type': 'linear',
  32. 'domain': [10, 50, 100, 1000000000],
  33. 'range': ['#00DB24', '#FFC000', '#c40022', '#c40022']
  34. }
  35. ],
  36. 'axes': [
  37. {
  38. 'type': 'x',
  39. 'scale': 'x',
  40. 'ticks': 6,
  41. 'name': 'Latency (ms)'
  42. },
  43. {
  44. 'type': 'y',
  45. 'scale': 'y',
  46. 'properties': {
  47. 'ticks': {
  48. 'stroke': {'value': 'transparent'}
  49. },
  50. 'majorTicks': {
  51. 'stroke': {'value': 'transparent'}
  52. },
  53. 'labels': {
  54. 'fill': {'value': 'transparent'}
  55. },
  56. 'axis': {
  57. 'stroke': {'value': '#333'},
  58. 'strokeWidth': {'value': 1}
  59. }
  60. }
  61. }
  62. ],
  63. 'marks': [
  64. {
  65. 'type': 'rect',
  66. 'from': {'data': 'stats'},
  67. 'properties': {
  68. 'enter': {
  69. 'x': {'scale': 'x', 'value': 0},
  70. 'x2': {'scale': 'x', 'field': 'data.latency.current'},
  71. 'y': {'scale': 'y', 'field': 'index', 'offset': -1},
  72. 'height': {'value': 3},
  73. 'fill': {'scale':'color', 'field':'data.latency.current'}
  74. }
  75. }
  76. },
  77. {
  78. 'type': 'symbol',
  79. 'from': {'data': 'stats'},
  80. 'properties': {
  81. 'enter': {
  82. 'x': {'scale': 'x', 'field': 'data.latency.current'},
  83. 'y': {'scale': 'y', 'field': 'index'},
  84. 'size': {'value': 50},
  85. 'fill': {'value': '#000'}
  86. }
  87. }
  88. }
  89. ]
  90. });