MonthIO.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. Ext.define('saas.view.home.charts.MonthIO', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'month-io',
  4. id: 'month_io',
  5. title: '本月收入支出额(万元)',
  6. initComponent: function () {
  7. var me = this;
  8. Ext.apply(me, {
  9. items: [{
  10. xtype: 'echartsbase',
  11. bind: {
  12. store: '{month_io}',
  13. },
  14. createOption: me.createOption
  15. }]
  16. });
  17. me.callParent(arguments);
  18. },
  19. createOption: function (store) {
  20. var fields = [],
  21. main = [],
  22. other = [],
  23. data = [];
  24. store.each(function (d) {
  25. var d = d.data;
  26. // fields.push(d.x);
  27. main.push(d.main);
  28. other.push(d.other);
  29. });
  30. var o = {
  31. color: [
  32. '#2C82BE',
  33. '#82CCFF'
  34. ],
  35. tooltip: {
  36. trigger: 'axis',
  37. formatter: function (params, ticket, callback) {
  38. var name = '',
  39. total = 0,
  40. series = [];
  41. for(var x = 0; x < params.length; x++) {
  42. var p = params[x],
  43. marker = p.marker,
  44. seriesName = p.seriesName,
  45. name = p.name,
  46. value = p.value;
  47. total += value;
  48. value = saas.util.BaseUtil.numberFormat(value, 4, true);
  49. series.push(marker + seriesName + ': ' + value);
  50. }
  51. total = saas.util.BaseUtil.numberFormat(total, 4, true);
  52. return name + ': ' + total + '<br/>' + series.join('<br/>');
  53. }
  54. },
  55. legend: {
  56. orient: 'horizontal',
  57. left: 0,
  58. icon: 'circle',
  59. data: ['主营业务', '其他业务'],
  60. itemWidth: 9,
  61. itemHeight: 9
  62. },
  63. grid: {
  64. left: 0,
  65. right: 0,
  66. bottom: 5,
  67. top: 40,
  68. borderColor: '#E5EAEF',
  69. containLabel: true
  70. },
  71. xAxis: [{
  72. type: 'category',
  73. data: ['收入', '支出'],
  74. axisLine: {
  75. lineStyle: {
  76. color: '#E5EAEF',
  77. }
  78. },
  79. axisLabel: {
  80. color: '#485465'
  81. },
  82. }],
  83. yAxis: [{
  84. type: 'value',
  85. axisLine: {
  86. lineStyle: {
  87. color: '#E5EAEF',
  88. }
  89. },
  90. splitLine: {
  91. lineStyle: {
  92. color: ['#E5EAEF']
  93. }
  94. },
  95. axisLabel: {
  96. color: '#485465'
  97. }
  98. }],
  99. series: [{
  100. name: '主营业务',
  101. type: 'bar',
  102. stack: '合计',
  103. barWidth: 25,
  104. data: main
  105. },
  106. {
  107. name: '其他业务',
  108. type: 'bar',
  109. stack: '合计',
  110. barWidth: 25,
  111. data: other
  112. }]
  113. };
  114. return o;
  115. }
  116. });