StockAmount.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. fillStyle: '#485465'
  30. },
  31. style: {
  32. fill: '#F7F8FA',
  33. strokeStyle: 'transparent'
  34. },
  35. renderer: me.categoryRender
  36. },{
  37. type: 'numeric',
  38. fields: ['y'],
  39. position: 'left',
  40. grid: {
  41. even: {
  42. stroke: '#F7F8FA',
  43. },
  44. odd: {
  45. stroke: '#F7F8FA',
  46. }
  47. },
  48. label: {
  49. fillStyle: '#485465'
  50. },
  51. style: {
  52. fill: '#fff',
  53. strokeStyle: 'transparent'
  54. },
  55. }],
  56. series: [{
  57. type: 'bar',
  58. xField: 'x',
  59. yField: ['y'],
  60. tooltip: {
  61. trackMouse: true,
  62. renderer: me.onBarTipRender
  63. },
  64. bind: {
  65. style: {
  66. lineWidth: 0,
  67. strokeStyle: 'transparent',
  68. maxBarWidth: '{maxBarWidth}',
  69. },
  70. },
  71. }]
  72. }]
  73. });
  74. me.callParent(arguments);
  75. },
  76. onBarTipRender: function (tooltip, record, item) {
  77. tooltip.setHtml(record.get('x') + '月: ' + record.get('y') + '万元');
  78. },
  79. categoryRender: function(axis, label, layoutContext, lastLabel) {
  80. return label + '月';
  81. }
  82. });