Echarts 多个图表

矫情吗;* 2022-05-28 12:56 415阅读 0赞

一个Option 四个均匀分布图表

20180406111258634

  1. var dataAll = [
  2. [
  3. [10.0, 8.04],
  4. [8.0, 6.95],
  5. [13.0, 7.58],
  6. [9.0, 8.81],
  7. [11.0, 8.33],
  8. [14.0, 9.96],
  9. [6.0, 7.24],
  10. [4.0, 4.26],
  11. [12.0, 10.84],
  12. [7.0, 4.82],
  13. [5.0, 5.68]
  14. ],
  15. [
  16. [10.0, 9.14],
  17. [8.0, 8.14],
  18. [13.0, 8.74],
  19. [9.0, 8.77],
  20. [11.0, 9.26],
  21. [14.0, 8.10],
  22. [6.0, 6.13],
  23. [4.0, 3.10],
  24. [12.0, 9.13],
  25. [7.0, 7.26],
  26. [5.0, 4.74]
  27. ],
  28. [
  29. [10.0, 7.46],
  30. [8.0, 6.77],
  31. [13.0, 12.74],
  32. [9.0, 7.11],
  33. [11.0, 7.81],
  34. [14.0, 8.84],
  35. [6.0, 6.08],
  36. [4.0, 5.39],
  37. [12.0, 8.15],
  38. [7.0, 6.42],
  39. [5.0, 5.73]
  40. ],
  41. [
  42. [8.0, 6.58],
  43. [8.0, 5.76],
  44. [8.0, 7.71],
  45. [8.0, 8.84],
  46. [8.0, 8.47],
  47. [8.0, 7.04],
  48. [8.0, 5.25],
  49. [19.0, 12.50],
  50. [8.0, 5.56],
  51. [8.0, 7.91],
  52. [8.0, 6.89]
  53. ]
  54. ];
  55. var markLineOpt = {
  56. animation: false,
  57. label: {
  58. normal: {
  59. formatter: 'y = 0.5 * x + 3',
  60. textStyle: {
  61. align: 'right'
  62. }
  63. }
  64. },
  65. lineStyle: {
  66. normal: {
  67. type: 'solid'
  68. }
  69. },
  70. tooltip: {
  71. formatter: 'y = 0.5 * x + 3'
  72. },
  73. data: [[{
  74. coord: [0, 3],
  75. symbol: 'none'
  76. }, {
  77. coord: [20, 13],
  78. symbol: 'none'
  79. }]]
  80. };
  81. option = {
  82. title: {
  83. text: 'Anscombe\'s quartet',
  84. x: 'center',
  85. y: 0
  86. },
  87. grid: [
  88. /*38% 宽度图表刚好不接触*/
  89. /*左上*/
  90. {x: '7%', y: '7%', width: '38%', height: '38%'},
  91. /*右上*/
  92. {x2: '7%', y: '7%', width: '38%', height: '38%'},
  93. /*左下*/
  94. {x: '7%', y2: '7%', width: '38%', height: '38%'},
  95. /*右下*/
  96. {x2: '7%', y2: '7%', width: '38%', height: '38%'}
  97. ],
  98. tooltip: {
  99. formatter: 'Group {a}: ({c})'
  100. },
  101. xAxis: [
  102. {gridIndex: 0, min: 0, max: 20},
  103. {gridIndex: 1, min: 0, max: 20},
  104. {gridIndex: 2, min: 0, max: 20},
  105. {gridIndex: 3, min: 0, max: 20}
  106. ],
  107. yAxis: [
  108. {gridIndex: 0, min: 0, max: 15},
  109. {gridIndex: 1, min: 0, max: 15},
  110. {gridIndex: 2, min: 0, max: 15},
  111. {gridIndex: 3, min: 0, max: 15}
  112. ],
  113. series: [
  114. {
  115. name: 'I',
  116. type: 'scatter',
  117. xAxisIndex: 0,
  118. yAxisIndex: 0,
  119. data: dataAll[0],
  120. markLine: markLineOpt
  121. },
  122. {
  123. name: 'II',
  124. type: 'scatter',
  125. xAxisIndex: 1,
  126. yAxisIndex: 1,
  127. data: dataAll[1],
  128. markLine: markLineOpt
  129. },
  130. {
  131. name: 'III',
  132. type: 'scatter',
  133. xAxisIndex: 2,
  134. yAxisIndex: 2,
  135. data: dataAll[2],
  136. markLine: markLineOpt
  137. },
  138. {
  139. name: 'IV',
  140. type: 'scatter',
  141. xAxisIndex: 3,
  142. yAxisIndex: 3,
  143. data: dataAll[3],
  144. markLine: markLineOpt
  145. }
  146. ]
  147. };

左右均匀分布

  1. var dataAll = [389, 259, 262, 324, 232, 176, 196, 214, 133, 370];
  2. var yAxisData = ['原因1', '原因2', '原因3', '原因4', '原因5', '原因6', '原因7', '原因8', '原因9', '原因10'];
  3. var option = {
  4. backgroundColor: '#0f375f',
  5. title: [{
  6. text: "各渠道投诉占比",
  7. x: 'center',
  8. y: 0,
  9. textStyle: {
  10. color: "#fff",
  11. fontSize: "14"
  12. }
  13. }, ],
  14. grid: [{
  15. x: '7%',
  16. y: '7%',
  17. width: '38%'
  18. },
  19. {
  20. x2: '7%',
  21. y: '7%',
  22. width: '38%'
  23. },
  24. ],
  25. tooltip: {
  26. formatter: '{b} ({c})'
  27. },
  28. xAxis: [{
  29. gridIndex: 0,
  30. axisTick: {
  31. show: false
  32. },
  33. axisLabel: {
  34. show: false
  35. },
  36. splitLine: {
  37. show: false
  38. },
  39. axisLine: {
  40. show: false
  41. }
  42. },
  43. {
  44. gridIndex: 1,
  45. axisTick: {
  46. show: false
  47. },
  48. axisLabel: {
  49. show: false
  50. },
  51. splitLine: {
  52. show: false
  53. },
  54. axisLine: {
  55. show: false
  56. }
  57. },
  58. ],
  59. yAxis: [{
  60. gridIndex: 0,
  61. interval: 0,
  62. data: yAxisData.reverse(),
  63. axisTick: {
  64. show: false
  65. },
  66. axisLabel: {
  67. show: true
  68. },
  69. splitLine: {
  70. show: false
  71. },
  72. axisLine: {
  73. show: true,
  74. lineStyle: {
  75. color: "#6173a3"
  76. }
  77. },
  78. }, {
  79. gridIndex: 1,
  80. interval: 0,
  81. data: yAxisData.reverse(),
  82. axisTick: {
  83. show: false
  84. },
  85. axisLabel: {
  86. show: true
  87. },
  88. splitLine: {
  89. show: false
  90. },
  91. axisLine: {
  92. show: true,
  93. lineStyle: {
  94. color: "#6173a3"
  95. }
  96. },
  97. }],
  98. series: [
  99. {
  100. name: '投诉原因TOP10',
  101. type: 'bar',
  102. xAxisIndex: 0,
  103. yAxisIndex: 0,
  104. barWidth: '45%',
  105. itemStyle: {
  106. normal: {
  107. color: '#86c9f4'
  108. }
  109. },
  110. label: {
  111. normal: {
  112. show: true,
  113. position: "right",
  114. textStyle: {
  115. color: "#9EA7C4"
  116. }
  117. }
  118. },
  119. data: dataAll.sort(),
  120. }, {
  121. name: '各渠道投诉占比',
  122. type: 'bar',
  123. xAxisIndex: 1,
  124. yAxisIndex: 1,
  125. barWidth: '45%',
  126. itemStyle: {
  127. normal: {
  128. color: '#86c9f4'
  129. }
  130. },
  131. label: {
  132. normal: {
  133. show: true,
  134. position: "right",
  135. textStyle: {
  136. color: "#9EA7C4"
  137. }
  138. }
  139. },
  140. data: dataAll.sort(),
  141. },
  142. ]
  143. };

20180406110711811

发表评论

表情:
评论列表 (有 0 条评论,415人围观)

还没有评论,来说两句吧...

相关阅读

    相关 echarts图表演示图表演示

    eCharts图表演示 比如说,公司现在接一个项目,这个中信银行,针对之前所有的贷款、大 小客户,要做出来图表系统(演示和查看)、报表系统(用来打印)。 郑州的大数据产