Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.onReady(function() {
  8. var myStore = new Ext.data.ArrayStore({
  9. autoLoad: true,
  10. fields: [
  11. 'economy', 'region', 'year',
  12. {name: 'procedures', type: 'int'},
  13. {name: 'time', type: 'int'}
  14. ],
  15. url : 'countries.json'
  16. });
  17. var pivotGrid = new Ext.grid.PivotGrid({
  18. title : 'Ease of doing business',
  19. width : 800,
  20. height : 400,
  21. renderTo : 'docbody',
  22. store : myStore,
  23. aggregator: 'sum',
  24. measure : 'time',
  25. viewConfig: {
  26. getCellCls: function(value) {
  27. if (value < 20) {
  28. return 'expense-low';
  29. } else if (value < 75) {
  30. return 'expense-medium';
  31. } else {
  32. return 'expense-high';
  33. }
  34. }
  35. },
  36. leftAxis: [
  37. {
  38. width: 165,
  39. dataIndex: 'economy'
  40. }
  41. ],
  42. topAxis: [
  43. {
  44. dataIndex: 'year'
  45. }
  46. ],
  47. //toggles the Region dimension on and off
  48. tbar: [
  49. {
  50. text: 'Toggle Region',
  51. enableToggle: true,
  52. toggleHandler: function() {
  53. var leftAxis = pivotGrid.leftAxis,
  54. oldDimensions = leftAxis.dimensions,
  55. newDimensions = [];
  56. if (oldDimensions.length == 1) {
  57. newDimensions.push({
  58. width: 100,
  59. dataIndex: 'region'
  60. });
  61. }
  62. newDimensions.push({
  63. width: 165,
  64. dataIndex: 'economy'
  65. });
  66. leftAxis.setDimensions(newDimensions);
  67. pivotGrid.view.refresh(true);
  68. }
  69. }
  70. ]
  71. });
  72. });