Chart2.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Ext.define('school.view.analysis.consumption.Chart2', {
  2. extend: 'school.view.core.chart.ChartBase',
  3. xtype: 'consumption-chart2',
  4. title: '学生校园消费占比分析',
  5. initComponent: function () {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'echartsbase',
  10. bind: {
  11. store: '{chart2}',
  12. },
  13. createOption: me.createOption.bind(me)
  14. }]
  15. });
  16. me.callParent(arguments);
  17. },
  18. createOption: function (store) {
  19. var me = this,
  20. fields = [],
  21. data = [];
  22. store.each(function (d) {
  23. var d = d.data;
  24. fields.push(d.type);
  25. data.push({
  26. name: d.type,
  27. value: d.money
  28. });
  29. });
  30. o = {
  31. grid: {
  32. left: 0,
  33. right: 0,
  34. top: 60,
  35. bottom: 5,
  36. borderColor: '#E5EAEF',
  37. containLabel: true
  38. },
  39. tooltip : {
  40. trigger: 'item',
  41. formatter: "{a} <br/>{b} : {d}%"
  42. },
  43. legend: {
  44. data: fields
  45. },
  46. series : [{
  47. name: '消费类别',
  48. type: 'pie',
  49. radius : '55%',
  50. // center: ['40%', '50%'],
  51. data: data,
  52. itemStyle: {
  53. emphasis: {
  54. shadowBlur: 10,
  55. shadowOffsetX: 0,
  56. shadowColor: 'rgba(0, 0, 0, 0.5)'
  57. }
  58. }
  59. }]
  60. };
  61. return o;
  62. }
  63. });