RadarFill.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. Ext.require('Ext.chart.*');
  2. Ext.require(['Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit', 'Ext.window.MessageBox']);
  3. Ext.onReady(function () {
  4. store1.loadData(generateData());
  5. var chart = Ext.create('Ext.chart.Chart', {
  6. id: 'chartCmp',
  7. xtype: 'chart',
  8. style: 'background:#fff',
  9. theme: 'Category2',
  10. insetPadding: 20,
  11. animate: true,
  12. store: store1,
  13. legend: {
  14. position: 'right'
  15. },
  16. axes: [{
  17. type: 'Radial',
  18. position: 'radial',
  19. label: {
  20. display: true
  21. }
  22. }],
  23. series: [{
  24. showInLegend: true,
  25. type: 'radar',
  26. xField: 'name',
  27. yField: 'data1',
  28. style: {
  29. opacity: 0.4
  30. }
  31. },{
  32. showInLegend: true,
  33. type: 'radar',
  34. xField: 'name',
  35. yField: 'data2',
  36. style: {
  37. opacity: 0.4
  38. }
  39. },{
  40. showInLegend: true,
  41. type: 'radar',
  42. xField: 'name',
  43. yField: 'data3',
  44. style: {
  45. opacity: 0.4
  46. }
  47. }]
  48. });
  49. var win = Ext.create('Ext.Window', {
  50. width: 800,
  51. height: 600,
  52. minHeight: 400,
  53. minWidth: 550,
  54. hidden: false,
  55. shadow: false,
  56. maximizable: true,
  57. style: 'overflow: hidden;',
  58. title: 'Filled Radar Chart',
  59. renderTo: Ext.getBody(),
  60. layout: 'fit',
  61. tbar: [{
  62. text: 'Save Chart',
  63. handler: function() {
  64. Ext.MessageBox.confirm('Confirm Download', 'Would you like to download the chart as an image?', function(choice){
  65. if(choice == 'yes'){
  66. chart.save({
  67. type: 'image/png'
  68. });
  69. }
  70. });
  71. }
  72. }, {
  73. text: 'Reload Data',
  74. handler: function() {
  75. store1.loadData(generateData());
  76. }
  77. }, {
  78. enableToggle: true,
  79. pressed: true,
  80. text: 'Animate',
  81. toggleHandler: function(btn, pressed) {
  82. var chart = Ext.getCmp('chartCmp');
  83. chart.animate = pressed ? { easing: 'ease', duration: 500 } : false;
  84. }
  85. }],
  86. items: chart
  87. });
  88. });