MonthPurchase.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Ext.define('saas.view.home.charts.MonthPurchase', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'month-purchase',
  4. id: 'month-purchase',
  5. bind: {
  6. title: '本月采购额(万元):{month_purchase_amount}'
  7. },
  8. initComponent: function() {
  9. var me = this;
  10. Ext.apply(me, {
  11. items: [{
  12. xtype: 'cartesian',
  13. colors: [
  14. '#34BAF6'
  15. ],
  16. bind: {
  17. insetPadding: '{insetPadding}',
  18. store: '{month_purchase}',
  19. },
  20. axes: [{
  21. type: 'category',
  22. fields: ['x'],
  23. position: 'bottom',
  24. label: {
  25. fontSize: '12px',
  26. fillStyle: '#485465'
  27. },
  28. style: {
  29. fill: '#F7F8FA',
  30. strokeStyle: 'transparent'
  31. },
  32. },{
  33. type: 'numeric',
  34. fields: ['y'],
  35. position: 'left',
  36. adjustByMajorUnit: true,
  37. grid: {
  38. even: {
  39. stroke: '#F7F8FA'
  40. },
  41. odd: {
  42. stroke: '#F7F8FA',
  43. }
  44. },
  45. label: {
  46. fontSize: '12px',
  47. fillStyle: '#485465',
  48. textAlign: 'end'
  49. },
  50. style: {
  51. fill: '#fff',
  52. strokeStyle: 'transparent'
  53. },
  54. minimum: 0
  55. }],
  56. series: [{
  57. type: 'bar',
  58. xField: 'x',
  59. yField: ['y'],
  60. bind: {
  61. style: {
  62. lineWidth: 0,
  63. strokeStyle: 'transparent',
  64. maxBarWidth: '{maxBarWidth}',
  65. },
  66. },
  67. tooltip: {
  68. trackMouse: true,
  69. renderer: me.onBarTipRender
  70. }
  71. }]
  72. }]
  73. });
  74. me.callParent(arguments);
  75. },
  76. onBarTipRender: function (tooltip, record, item) {
  77. tooltip.setHtml(record.get('x') + ': ' + record.get('y') + '万元');
  78. },
  79. });