MonthIO.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Ext.define('saas.view.home.charts.MonthIO', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'month-io',
  4. id: 'month_io',
  5. // bind: {
  6. // title: '本月收入支出额(万元)<div style="text-align: right;"><span style="font-weight:bold;">收入:{month_in}</span><span style="font-weight:bold;margin-left: 10px;">支出:{month_out}</span></div>'
  7. // },
  8. title: '本月收入支出额(万元)',
  9. initComponent: function () {
  10. var me = this;
  11. Ext.apply(me, {
  12. items: [{
  13. xtype: 'cartesian',
  14. colors: [
  15. '#2C82BE',
  16. '#82CCFF'
  17. ],
  18. bind: {
  19. legend: {
  20. type: 'dom',
  21. docked: 'top',
  22. padding: 0,
  23. bodyPadding: 0,
  24. border: 0,
  25. cls: 'x-monthio-legend',
  26. html: '<div class="sumtip"><span>收入:{month_in}</span><span>支出:{month_out}</span></div>'
  27. },
  28. insetPadding: '{insetPadding}',
  29. store: '{month_io}'
  30. },
  31. axes: [{
  32. type: 'numeric',
  33. position: 'left',
  34. adjustByMajorUnit: true,
  35. fields: ['main'],
  36. minimum: 0,
  37. label: {
  38. fontSize: '12px',
  39. fillStyle: '#485465'
  40. },
  41. grid: {
  42. even: {
  43. stroke: '#E5EAEF'
  44. },
  45. odd: {
  46. stroke: '#E5EAEF',
  47. }
  48. },
  49. style: {
  50. fill: '#fff',
  51. strokeStyle: 'transparent'
  52. },
  53. }, {
  54. type: 'category',
  55. position: 'bottom',
  56. fields: ['x'],
  57. label: {
  58. fontSize: '12px',
  59. fillStyle: '#485465'
  60. },
  61. style: {
  62. fill: '#E5EAEF',
  63. strokeStyle: 'transparent'
  64. },
  65. }],
  66. series: [{
  67. type: 'bar',
  68. title: ['主营业务', '其他业务'],
  69. xField: 'x',
  70. yField: ['main', 'other'],
  71. stacked: true,
  72. bind: {
  73. style: {
  74. lineWidth: 0,
  75. strokeStyle: 'transparent',
  76. maxBarWidth: '{maxBarWidth}',
  77. },
  78. },
  79. tooltip: {
  80. trackMouse: true,
  81. renderer: me.onBarTipRender
  82. }
  83. }]
  84. }]
  85. });
  86. me.callParent(arguments);
  87. },
  88. onBarTipRender: function (tooltip, record, item) {
  89. var fieldIndex = Ext.Array.indexOf(item.series.getYField(), item.field),
  90. type = item.series.getTitle()[fieldIndex];
  91. tooltip.setHtml(type + record.get('x') + ': ' + Ext.util.Format.number(record.get(item.field), '0,000.00') + '万元');
  92. },
  93. });