StockAmount.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. Ext.define('saas.view.home.charts.StockAmount', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'stock-amount',
  4. id: 'stock_amount',
  5. title: '近六月库存金额图(万元)',
  6. initComponent: function () {
  7. var me = this;
  8. Ext.apply(me, {
  9. items: [{
  10. xtype: 'echartsbase',
  11. bind: {
  12. store: '{stock_amount}',
  13. },
  14. createOption: me.createOption
  15. }]
  16. });
  17. me.callParent(arguments);
  18. },
  19. createOption: function (store) {
  20. var fields = [],
  21. data = [];
  22. store.each(function (d) {
  23. var d = d.data;
  24. fields.push(d.x + '月');
  25. data.push(d.y);
  26. });
  27. return {
  28. color: [
  29. '#34BAF6'
  30. ],
  31. tooltip: {
  32. trigger: 'axis',
  33. formatter: function (params, ticket, callback) {
  34. var name = '',
  35. series = [];
  36. for(var x = 0; x < params.length; x++) {
  37. var p = params[x],
  38. marker = p.marker,
  39. seriesName = p.seriesName,
  40. name = p.name,
  41. value = p.value;
  42. value = saas.util.BaseUtil.numberFormat(value, 4, true);
  43. series.push(marker + value);
  44. }
  45. return name + ': ' + '<br/>' + series.join('<br/>');
  46. }
  47. },
  48. grid: {
  49. left: 0,
  50. right: 0,
  51. bottom: 5,
  52. top: 10,
  53. borderColor: '#E5EAEF',
  54. containLabel: true
  55. },
  56. xAxis: {
  57. type: 'category',
  58. data: fields,
  59. axisLine: {
  60. lineStyle: {
  61. color: '#E5EAEF',
  62. }
  63. },
  64. axisLabel: {
  65. color: '#485465'
  66. },
  67. },
  68. yAxis: {
  69. type: 'value',
  70. axisLine: {
  71. lineStyle: {
  72. color: '#E5EAEF',
  73. }
  74. },
  75. splitLine: {
  76. lineStyle: {
  77. color: ['#E5EAEF']
  78. }
  79. },
  80. axisLabel: {
  81. color: '#485465'
  82. }
  83. },
  84. series: [{
  85. type: 'bar',
  86. barWidth: 25,
  87. data: data
  88. }]
  89. }
  90. }
  91. });