PurchaseTrend.js 3.0 KB

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