MonthPurchase.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. fillStyle: '#485465'
  26. },
  27. style: {
  28. fill: '#F7F8FA',
  29. strokeStyle: 'transparent'
  30. },
  31. },{
  32. type: 'numeric',
  33. fields: ['y'],
  34. position: 'left',
  35. adjustByMajorUnit: true,
  36. grid: {
  37. even: {
  38. stroke: '#F7F8FA'
  39. },
  40. odd: {
  41. stroke: '#F7F8FA',
  42. }
  43. },
  44. label: {
  45. fillStyle: '#485465',
  46. textAlign: 'end'
  47. },
  48. style: {
  49. fill: '#fff',
  50. strokeStyle: 'transparent'
  51. },
  52. minimum: 0
  53. }],
  54. series: [{
  55. type: 'bar',
  56. xField: 'x',
  57. yField: ['y'],
  58. bind: {
  59. style: {
  60. lineWidth: 0,
  61. strokeStyle: 'transparent',
  62. maxBarWidth: '{maxBarWidth}',
  63. },
  64. },
  65. tooltip: {
  66. trackMouse: true,
  67. renderer: me.onBarTipRender
  68. }
  69. }]
  70. }]
  71. });
  72. me.callParent(arguments);
  73. },
  74. onBarTipRender: function (tooltip, record, item) {
  75. tooltip.setHtml(record.get('x') + ': ' + record.get('y') + '万元');
  76. },
  77. });