PurchaseTrend.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Ext.define('saas.view.home.charts.PurchaseTrend', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'purchase-trend',
  4. id: 'purchase_trend',
  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. captions: {
  16. title: {
  17. text: '采购金额(万元)',
  18. style: {
  19. 'font-size': '14px',
  20. 'color': '#485465',
  21. 'letter-spacing': '-0.07px'
  22. },
  23. align: 'left'
  24. }
  25. },
  26. store: '{purchase_trend}',
  27. },
  28. axes: [{
  29. // title: {
  30. // text: '月',
  31. // fontSize: 14,
  32. // },
  33. type: 'category',
  34. fields: ['x'],
  35. position: 'bottom',
  36. label: {
  37. fillStyle: '#485465'
  38. },
  39. style: {
  40. fill: '#F7F8FA',
  41. strokeStyle: 'transparent'
  42. },
  43. renderer: me.categoryRender
  44. },{
  45. type: 'numeric',
  46. fields: ['y'],
  47. position: 'left',
  48. grid: {
  49. even: {
  50. stroke: '#F7F8FA'
  51. },
  52. odd: {
  53. stroke: '#F7F8FA',
  54. }
  55. },
  56. label: {
  57. fillStyle: '#485465'
  58. },
  59. style: {
  60. fill: '#fff',
  61. strokeStyle: 'transparent'
  62. },
  63. }],
  64. series: [{
  65. type: 'bar',
  66. xField: 'x',
  67. yField: ['y'],
  68. tooltip: {
  69. trackMouse: true,
  70. renderer: me.onBarTipRender
  71. },
  72. style: {
  73. lineWidth: 0,
  74. strokeStyle: 'transparent',
  75. maxBarWidth: 50,
  76. },
  77. }]
  78. }]
  79. });
  80. me.callParent(arguments);
  81. },
  82. onBarTipRender: function (tooltip, record, item) {
  83. tooltip.setHtml(record.get('x') + ': ' + record.get('y') + '万元');
  84. },
  85. categoryRender: function(axis, label, layoutContext, lastLabel) {
  86. return label + '月';
  87. }
  88. });