PurchaseTrend.js 3.1 KB

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