StockAmount.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Ext.define('saas.view.home.charts.StockAmount', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'stock-amount',
  4. id: 'stock_amount',
  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: '{stock_amount}',
  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: '#E2E7ED',
  34. strokeStyle: 'transparent'
  35. },
  36. renderer: me.categoryRender
  37. },{
  38. type: 'numeric',
  39. fields: ['y'],
  40. position: 'left',
  41. grid: {
  42. even: {
  43. stroke: '#E2E7ED',
  44. },
  45. odd: {
  46. stroke: '#E2E7ED',
  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. bind: {
  67. style: {
  68. lineWidth: 0,
  69. strokeStyle: 'transparent',
  70. maxBarWidth: '{maxBarWidth}',
  71. },
  72. },
  73. }]
  74. }]
  75. });
  76. me.callParent(arguments);
  77. },
  78. onBarTipRender: function (tooltip, record, item) {
  79. tooltip.setHtml(record.get('x') + '月: ' + Ext.util.Format.number(record.get('y'), '0,000.00') + '万元');
  80. },
  81. categoryRender: function(axis, label, layoutContext, lastLabel) {
  82. return label + '月';
  83. }
  84. });