MonthIO.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. reference: 'chart',
  11. colors: [
  12. '#2C82BE',
  13. '#82CCFF'
  14. ],
  15. bind: {
  16. captions: {
  17. title: {
  18. text: '本月收入(万元):{month_in}\n本月支出(万元):{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. grid: {
  40. even: {
  41. stroke: '#E7EBEF'
  42. },
  43. odd: {
  44. stroke: '#E7EBEF',
  45. }
  46. },
  47. style: {
  48. fill: '#fff',
  49. strokeStyle: 'transparent'
  50. },
  51. }, {
  52. type: 'category',
  53. position: 'bottom',
  54. fields: ['x'],
  55. style: {
  56. fill: '#E7EBEF',
  57. strokeStyle: 'transparent'
  58. },
  59. }],
  60. series: [{
  61. type: 'bar',
  62. title: ['主营业务', '其他业务'],
  63. xField: 'x',
  64. yField: ['main', 'other'],
  65. stacked: true,
  66. style: {
  67. lineWidth: 0,
  68. strokeStyle: 'transparent',
  69. maxBarWidth: 50,
  70. },
  71. tooltip: {
  72. trackMouse: true,
  73. renderer: me.onBarTipRender
  74. }
  75. }]
  76. }]
  77. });
  78. me.callParent(arguments);
  79. },
  80. onBarTipRender: function (tooltip, record, item) {
  81. var fieldIndex = Ext.Array.indexOf(item.series.getYField(), item.field),
  82. type = item.series.getTitle()[fieldIndex];
  83. tooltip.setHtml(type + record.get('x') + record.get(item.field));
  84. },
  85. });