MonthPurchase.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. Ext.define('saas.view.home.charts.MonthPurchase', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'month-purchase',
  4. id: 'month-purchase',
  5. initComponent: function() {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'cartesian',
  10. colors: [
  11. '#34BAF6'
  12. ],
  13. bind: {
  14. store: '{month_purchase}',
  15. captions: {
  16. title: {
  17. text: '本月采购额(万元):{month_purchase_amount}',
  18. style: {
  19. 'font-size': '14px',
  20. 'color': '#485465',
  21. 'letter-spacing': '-0.07px'
  22. },
  23. align: 'left'
  24. }
  25. },
  26. },
  27. axes: [{
  28. type: 'category',
  29. fields: ['x'],
  30. position: 'bottom',
  31. style: {
  32. fill: '#E7EBEF',
  33. strokeStyle: 'transparent'
  34. },
  35. },{
  36. type: 'numeric',
  37. fields: ['y'],
  38. position: 'left',
  39. adjustByMajorUnit: true,
  40. grid: {
  41. even: {
  42. stroke: '#E7EBEF'
  43. },
  44. odd: {
  45. stroke: '#E7EBEF',
  46. }
  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. style: {
  59. lineWidth: 0,
  60. strokeStyle: 'transparent',
  61. maxBarWidth: 50,
  62. },
  63. tooltip: {
  64. trackMouse: true,
  65. renderer: me.onBarTipRender
  66. }
  67. }]
  68. }]
  69. });
  70. me.callParent(arguments);
  71. },
  72. onBarTipRender: function (tooltip, record, item) {
  73. tooltip.setHtml(record.get('x') + ': ' + record.get('y') + '万元');
  74. },
  75. });