MonthSale.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Ext.define('saas.view.home.charts.MonthSale', {
  2. extend: 'saas.view.core.chart.ChartBase',
  3. xtype: 'month-sale',
  4. id: 'month_sale',
  5. initComponent: function() {
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. xtype: 'polar',
  10. reference: 'chart',
  11. bind: {
  12. captions: {
  13. title: {
  14. text: '本月销售额(万元):{month_sale_amount}',
  15. style: {
  16. 'font-size': '14px',
  17. 'color': '#485465',
  18. 'letter-spacing': '-0.07px'
  19. },
  20. align: 'left'
  21. }
  22. },
  23. store: '{month_sale}',
  24. },
  25. colors: [
  26. '#2C82BE',
  27. '#27A7FF',
  28. '#82CCFF',
  29. '#53A8E2',
  30. '#76DDFB',
  31. '#DBECF8',
  32. ],
  33. width: '100%',
  34. innerPadding: 20,
  35. // legend: {
  36. // docked: 'bottom'
  37. // },
  38. interactions: ['rotate', 'itemhighlight'],
  39. series: [{
  40. type: 'pie',
  41. angleField: 'y',
  42. donut: 55,
  43. label: {
  44. field: 'x',
  45. renderer: me.onLabelRender
  46. },
  47. highlight: true,
  48. tooltip: {
  49. trackMouse: true,
  50. renderer: me.onSeriesTooltipRender
  51. },
  52. }]
  53. }],
  54. });
  55. me.callParent(arguments);
  56. },
  57. onLabelRender: function(text, sprite, config, rendererData, index) {
  58. var homeModel = Ext.getCmp('home').getViewModel();
  59. var monthSaleAmount = homeModel.get('month_sale_amount');
  60. return text;
  61. },
  62. onSeriesTooltipRender: function (tooltip, record, item) {
  63. tooltip.setHtml(record.get('x') + ': ' + record.get('y'));
  64. }
  65. });