MonthPurchase.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. insetPadding: '28 0 0 0',
  11. colors: [
  12. '#34BAF6'
  13. ],
  14. bind: {
  15. store: '{month_purchase}',
  16. captions: {
  17. title: {
  18. text: '本月采购额(万元):{month_purchase_amount}',
  19. align: 'left',
  20. style: {
  21. 'color': '#485465',
  22. },
  23. }
  24. },
  25. },
  26. axes: [{
  27. type: 'category',
  28. fields: ['x'],
  29. position: 'bottom',
  30. label: {
  31. fillStyle: '#485465'
  32. },
  33. style: {
  34. fill: '#F7F8FA',
  35. strokeStyle: 'transparent'
  36. },
  37. },{
  38. type: 'numeric',
  39. fields: ['y'],
  40. position: 'left',
  41. adjustByMajorUnit: true,
  42. grid: {
  43. even: {
  44. stroke: '#F7F8FA'
  45. },
  46. odd: {
  47. stroke: '#F7F8FA',
  48. }
  49. },
  50. label: {
  51. fillStyle: '#485465',
  52. textAlign: 'end'
  53. },
  54. style: {
  55. fill: '#fff',
  56. strokeStyle: 'transparent'
  57. },
  58. minimum: 0
  59. }],
  60. series: [{
  61. type: 'bar',
  62. xField: 'x',
  63. yField: ['y'],
  64. style: {
  65. lineWidth: 0,
  66. strokeStyle: 'transparent',
  67. maxBarWidth: 50,
  68. },
  69. tooltip: {
  70. trackMouse: true,
  71. renderer: me.onBarTipRender
  72. }
  73. }]
  74. }]
  75. });
  76. me.callParent(arguments);
  77. },
  78. onBarTipRender: function (tooltip, record, item) {
  79. tooltip.setHtml(record.get('x') + ': ' + record.get('y') + '万元');
  80. },
  81. });