StockAmount.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Ext.define('saas.view.home.charts.StockAmount', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'stock-amount',
  4. id: 'stock_amount',
  5. initComponent: function() {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'cartesian',
  10. colors: [
  11. '#34BAF6'
  12. ],
  13. captions: {
  14. title: {
  15. text: '库存金额(万元)',
  16. style: {
  17. 'font-size': '14px',
  18. 'color': '#485465',
  19. 'letter-spacing': '-0.07px'
  20. },
  21. align: 'left'
  22. }
  23. },
  24. bind: {
  25. store: '{stock_amount}',
  26. },
  27. axes: [{
  28. // title: {
  29. // text: '月',
  30. // fontSize: 14,
  31. // },
  32. type: 'category',
  33. fields: ['x'],
  34. position: 'bottom',
  35. style: {
  36. fill: '#E7EBEF',
  37. strokeStyle: 'transparent'
  38. },
  39. renderer: me.categoryRender
  40. },{
  41. type: 'numeric',
  42. fields: ['y'],
  43. position: 'left',
  44. grid: {
  45. even: {
  46. stroke: '#E7EBEF',
  47. },
  48. odd: {
  49. stroke: '#E7EBEF',
  50. }
  51. },
  52. style: {
  53. fill: '#fff',
  54. strokeStyle: 'transparent'
  55. },
  56. }],
  57. series: [{
  58. type: 'bar',
  59. xField: 'x',
  60. yField: ['y'],
  61. tooltip: {
  62. trackMouse: true,
  63. renderer: me.onBarTipRender
  64. },
  65. style: {
  66. lineWidth: 0,
  67. strokeStyle: 'transparent',
  68. maxBarWidth: 50,
  69. },
  70. }]
  71. }]
  72. });
  73. me.callParent(arguments);
  74. },
  75. onBarTipRender: function (tooltip, record, item) {
  76. tooltip.setHtml(record.get('x') + ': ' + record.get('y') + '万元');
  77. },
  78. categoryRender: function(axis, label, layoutContext, lastLabel) {
  79. return label + '月';
  80. }
  81. });