echarts.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. define(function (require) {
  2. var $chart;
  3. return function (context) {
  4. return {
  5. north: {
  6. height: 400,
  7. border: false,
  8. items: {
  9. xtype: 'layout',
  10. west: {
  11. width: '50%',
  12. border: false,
  13. items: {
  14. xtype: 'echarts',
  15. onRender: function () {
  16. $chart = $(this);
  17. $chart.echarts({
  18. title: {
  19. text: '产品A销售示意图',
  20. left: 'center',
  21. top: '13'
  22. },
  23. xAxis: {
  24. type: 'category',
  25. data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
  26. axisLabel: { formatter: '{value}月' }
  27. },
  28. yAxis: {
  29. type: 'value',
  30. axisLabel: { formatter: '{value}件' }
  31. },
  32. series: [{
  33. data: [820, 932, 901, 934, 1290, 1330, 1320, 901, 934, 1290, 1330, 1320],
  34. type: 'line'
  35. }],
  36. color: ['red']
  37. });
  38. }
  39. }
  40. },
  41. center: {
  42. border: false,
  43. items: {
  44. xtype: 'echarts',
  45. onRender: function () {
  46. $chart = $(this);
  47. $chart.echarts({
  48. title: {
  49. text: '仓库上月各类产品销售示意图',
  50. x: 'center',
  51. top: '30'
  52. },
  53. tooltip: {
  54. trigger: 'item',
  55. formatter: "{a} <br/>{b} : {c} ({d}%)"
  56. },
  57. series: [
  58. {
  59. name: '当前产品信息',
  60. type: 'pie',
  61. radius: '55%',
  62. center: ['50%', '60%'],
  63. data: [
  64. { value: 335, name: '产品A' },
  65. { value: 310, name: '产品B' },
  66. { value: 234, name: '产品C' },
  67. { value: 135, name: '产品D' },
  68. { value: 1548, name: '产品E' }
  69. ],
  70. itemStyle: {
  71. emphasis: {
  72. shadowBlur: 10,
  73. shadowOffsetX: 0,
  74. shadowColor: 'rgba(0, 0, 0, 0.5)'
  75. }
  76. }
  77. }
  78. ]
  79. });
  80. }
  81. }
  82. }
  83. }
  84. },
  85. center: {
  86. border: false,
  87. items: {
  88. xtype: 'echarts',
  89. onRender: function () {
  90. $chart = $(this);
  91. },
  92. title: {
  93. text: '产品销售示意图',
  94. left: 'center',
  95. },
  96. xAxis: {
  97. data: ["大白兔奶糖", "狂神篮球", "白色T恤", "产品1", "产品2", "夹板"]
  98. },
  99. yAxis: {},
  100. series: [{
  101. name: '销量',
  102. type: 'bar',
  103. data: [5, 20, 36, 10, 10, 20]
  104. }],
  105. color: ['#004c8b']
  106. }
  107. }
  108. };
  109. };
  110. }
  111. );