Gauge.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Ext.require(['Ext.chart.*', 'Ext.chart.axis.Gauge', 'Ext.chart.series.*', 'Ext.Window']);
  2. Ext.onReady(function () {
  3. Ext.create('Ext.Window', {
  4. width: 800,
  5. height: 250,
  6. minWidth: 650,
  7. minHeight: 225,
  8. title: 'Gauge Charts',
  9. tbar: [{
  10. text: 'Reload Data',
  11. handler: function() {
  12. store1.loadData(generateData(1));
  13. store3.loadData(generateData(1));
  14. store4.loadData(generateData(1));
  15. }
  16. }],
  17. layout: {
  18. type: 'hbox',
  19. align: 'stretch'
  20. },
  21. items: [{
  22. xtype: 'chart',
  23. style: 'background:#fff',
  24. animate: {
  25. easing: 'elasticIn',
  26. duration: 1000
  27. },
  28. store: store1,
  29. insetPadding: 25,
  30. flex: 1,
  31. axes: [{
  32. type: 'gauge',
  33. position: 'gauge',
  34. minimum: 0,
  35. maximum: 100,
  36. steps: 10,
  37. margin: -10
  38. }],
  39. series: [{
  40. type: 'gauge',
  41. field: 'data1',
  42. donut: false,
  43. colorSet: ['#F49D10', '#ddd']
  44. }]
  45. }, {
  46. xtype: 'chart',
  47. style: 'background:#fff',
  48. animate: true,
  49. store: store3,
  50. insetPadding: 25,
  51. flex: 1,
  52. axes: [{
  53. type: 'gauge',
  54. position: 'gauge',
  55. minimum: 0,
  56. maximum: 100,
  57. steps: 10,
  58. margin: 7
  59. }],
  60. series: [{
  61. type: 'gauge',
  62. field: 'data1',
  63. donut: 30,
  64. colorSet: ['#82B525', '#ddd']
  65. }]
  66. }, {
  67. xtype: 'chart',
  68. style: 'background:#fff',
  69. animate: {
  70. easing: 'bounceOut',
  71. duration: 500
  72. },
  73. store: store4,
  74. insetPadding: 25,
  75. flex: 1,
  76. axes: [{
  77. type: 'gauge',
  78. position: 'gauge',
  79. minimum: 0,
  80. maximum: 100,
  81. steps: 10,
  82. margin: 7
  83. }],
  84. series: [{
  85. type: 'gauge',
  86. field: 'data1',
  87. donut: 80,
  88. colorSet: ['#3AA8CB', '#ddd']
  89. }]
  90. }]
  91. }).show();
  92. });