MonthIO.js 3.1 KB

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