column3.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. layui.use(['echarts'], function() {
  2. let echarts = layui.echarts;
  3. var column3 = echarts.init(document.getElementById('column3'),null, {
  4. width: 600,
  5. height: 400
  6. });
  7. const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF']
  8. option = {
  9. backgroundColor: '#fff',
  10. tooltip: {
  11. trigger: "axis",
  12. padding: [8, 10],
  13. backgroundColor: 'rgba(255,255,255,0.5)',
  14. axisPointer: {
  15. type: "shadow",
  16. color: "#fff"
  17. }
  18. },
  19. legend: {
  20. data: ['新开会员', '激活会员', '关闭会员'],
  21. align: 'left',
  22. right: 0,
  23. color: "#333",
  24. fontSize: 14,
  25. fontWeight: 200,
  26. itemWidth: 14,
  27. itemHeight: 14,
  28. itemGap: 35
  29. },
  30. grid: {
  31. left: '0',
  32. right: '0',
  33. bottom: '8%',
  34. top: '15%',
  35. containLabel: true
  36. },
  37. label: {
  38. show: true,
  39. position: 'top',
  40. color: '#333',
  41. fontSize: 14,
  42. fontWeight: 700
  43. },
  44. xAxis: [{
  45. type: 'category',
  46. offset: 10,
  47. data: ['团队1', '团队2', '团队3', '团队4'],
  48. axisLine: {
  49. show: false
  50. },
  51. axisTick: {
  52. show: false
  53. },
  54. axisLabel: {
  55. show: true,
  56. color: "#333",
  57. fontSize: 16,
  58. fontWeight: 200
  59. },
  60. }],
  61. yAxis: [{
  62. type: 'value',
  63. axisLabel: {
  64. show: false
  65. },
  66. axisTick: {
  67. show: false
  68. },
  69. axisLine: {
  70. show: false
  71. },
  72. splitLine: {
  73. show: false
  74. }
  75. }],
  76. series: [{
  77. name: '新开会员',
  78. type: 'bar',
  79. data: [20, 34, 18, 14, 16],
  80. barWidth: 22, //柱子宽度
  81. barGap: 1, //柱子之间间距
  82. itemStyle: {
  83. color: '#0071c8',
  84. opacity: 1,
  85. }
  86. }, {
  87. name: '激活会员',
  88. type: 'bar',
  89. data: [10, 24, 5, 24, 16],
  90. barWidth: 22,
  91. barGap: 1,
  92. itemStyle: {
  93. color: '#fdc508',
  94. opacity: 1,
  95. }
  96. }, {
  97. name: '关闭会员',
  98. type: 'bar',
  99. data: [7, 24, 18, 20, 6],
  100. barWidth: 22,
  101. barGap: 1,
  102. itemStyle: {
  103. color: '#dfeafc',
  104. opacity: 1,
  105. }
  106. }]
  107. };
  108. column3.setOption(option);
  109. window.onresize = function() {
  110. column3.resize();
  111. }
  112. })