test.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>ECharts</title>
  6. <!-- 引入 echarts.js -->
  7. <script src="echarts.min.js"></script>
  8. <style>
  9. html {
  10. background-color: #041128;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
  16. <div id="line" style="width: 600px;height:240px;"></div>
  17. <div id="line2" style="width: 600px;height:300px;"></div>
  18. <div id="line3" style="width: 600px;height:300px;"></div>
  19. <div id="pie" style="width: 600px;height:400px;"></div>
  20. <div id="ring" style="width: 600px;height:400px;"></div>
  21. <div id="curve" style="width: 600px;height:240px;"></div>
  22. <div id="radar" style="width: 300px;height:300px;"></div>
  23. <div id="ccc" style="width: 600px;height:300px;"></div>
  24. <script type="text/javascript">
  25. //const drawType = 'canvas';
  26. const drawType = 'svg';
  27. let line = echarts.init(document.getElementById('line'), null, {renderer: drawType});
  28. line.hideLoading();
  29. line.setOption({
  30. backgroundColor: '',
  31. xAxis: {
  32. axisTick:{show:false}, axisLabel:{color:'rgb(139,146,158)'}, axisLine:{lineStyle:{color:'rgb(20,29,59)', width:3}},
  33. data: ["语文","数学","英语","物理","化学","地理", '政治', '历史'],
  34. },
  35. yAxis: {
  36. axisTick:{show:false}, axisLabel:{color:'rgb(139,146,158)'}, axisLine:{lineStyle:{width:0}},
  37. splitLine: {show: true, lineStyle:{width: 2, color: '#141D3B'}},
  38. },
  39. series: [{
  40. name: '错题搜拍数量', type: 'bar', barWidth: 20,
  41. itemStyle: {normal:{color:new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#01D9FE'},{offset:1,color:'#0477D5'}])}},
  42. data: [68,136,198,145,180,130,27,200]
  43. }]
  44. });
  45. line.hideLoading();
  46. let line2 = echarts.init(document.getElementById('line2'), null, {renderer: drawType});
  47. line2.setOption({
  48. backgroundColor: '',
  49. /*tooltip : {trigger: 'axis'},*/
  50. yAxis : [
  51. {
  52. type : 'category', axisTick:{show:false}, axisLabel:{color:'#8B929E'}, axisLine:{lineStyle:{color:'#4F596C', width:2}},
  53. data: ["七(一)班","七(二)班","八(一)班","八(二)班","九(一)班"],
  54. },
  55. {
  56. type : 'category',axisLine: {show:false},axisTick:{show:false},axisLabel:{show:false},splitArea:{show:false},splitLine:{show:false},
  57. data: ["七(一)班","七(二)班","八(一)班","八(二)班","九(一)班"],
  58. }
  59. ],
  60. xAxis : {
  61. axisTick:{show:false}, axisLine:{lineStyle:{width:0}}, splitLine: {show: true, lineStyle:{width: 1, color: '#141D3B'}},
  62. max: 350, splitNumber: 7
  63. },
  64. series: [{
  65. name: '作业发布TOP', type: 'bar', barWidth: 15, yAxisIndex:1, itemStyle: {normal: {color:'#193F80', barBorderRadius:3}},
  66. data: [350,350,350,350,350,350]
  67. }, {
  68. name: '作业发布TOP', type: 'bar', barWidth: 15,
  69. itemStyle: {normal: {
  70. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{offset: 0, color: '#0477D5'}, {offset: 1, color: '#01D9FE'}]),
  71. barBorderRadius: 3
  72. }},
  73. data: [63,148,293,208,160]
  74. }]
  75. });
  76. let line3 = echarts.init(document.getElementById('line3'), null, {renderer: drawType});
  77. line3.setOption({
  78. backgroundColor: '',
  79. /*tooltip : {trigger: 'axis'},*/
  80. yAxis : [
  81. {
  82. type : 'category', axisTick:{show:false}, axisLabel:{color:'#8B929E'}, axisLine:{lineStyle:{color:'#4F596C', width:2}},
  83. data: ["七(一)班","七(二)班","八(一)班","八(二)班","九(一)班"],
  84. },
  85. {
  86. type : 'category',axisLine: {show:false},axisTick:{show:false},axisLabel:{show:false},splitArea:{show:false},splitLine:{show:false},
  87. data: ["七(一)班","七(二)班","八(一)班","八(二)班","九(一)班"],
  88. }
  89. ],
  90. xAxis : {
  91. axisTick:{show:false}, axisLine:{lineStyle:{width:0}}, splitLine: {show: true, lineStyle:{width: 1, color: '#141D3B'}},
  92. max: 350, splitNumber: 7
  93. },
  94. series: [{
  95. name: '作业发布TOP', type: 'bar', barWidth: 15, yAxisIndex:1, itemStyle: {normal: {color:'#193F80', barBorderRadius:3}},
  96. data: [350,350,350,350,350,350]
  97. }, {
  98. name: '作业发布TOP', type: 'bar', barWidth: 15,
  99. itemStyle: {normal: {
  100. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{offset: 0, color: '#0477D5'}, {offset: 1, color: '#01D9FE'}]),
  101. barBorderRadius: 3
  102. }},
  103. data: [63,148,293,208,160]
  104. }]
  105. });
  106. let pie = echarts.init(document.getElementById('pie'), null, {renderer: drawType});
  107. pie.setOption({
  108. backgroundColor: '',
  109. series : [{
  110. name: '在线人数', type: 'pie', radius: '35%',color:['#00E4EB', '#FDB627','#0091F1'],startAngle:135,
  111. data:[
  112. {value:20, name:'学生 20人'},
  113. {value:20, name:'家长 20人'},
  114. {value:110, name:'老师 110人'}
  115. ]
  116. }]
  117. });
  118. let ring = echarts.init(document.getElementById('ring'), null, {renderer: drawType});
  119. ring.setOption({
  120. backgroundColor: '',
  121. series: [{
  122. name:'名师课观看次数', startAngle:180, type:'pie', radius: ['22%', '35%'], avoidLabelOverlap: true,
  123. color:['#00D88B', '#6A97F3','#EB6F49','#FDB627', '#0091F1', '#00E4EB','#D1FBEF','#F9D858','#4CD0DD','#DF86F0','#F5A7C1'],
  124. label: {normal: {show: true, position: 'left'}, emphasis: {show: true, textStyle: {fontSize: '20', fontWeight: 'bold'}}},
  125. data:[
  126. {value:40, name:'语文\n40次\n40%'},
  127. {value:34, name:'政治\n34次\n34%'},
  128. {value:17, name:'历史\n17次\n17%'},
  129. {value:20, name:'化学\n20次\n20%'},
  130. {value:20, name:'物理\n20次\n20%'},
  131. {value:20, name:'生物\n20次\n20%'}
  132. ]
  133. }]
  134. });
  135. let curve = echarts.init(document.getElementById('curve'), null, {renderer: drawType});
  136. curve.setOption({
  137. backgroundColor: '',
  138. xAxis: {
  139. type: 'category',
  140. axisTick:{show:false},
  141. boundaryGap: false,
  142. axisLabel:{color:'rgba(255,255,255, 0.61)', interval: 0},
  143. axisLine:{lineStyle:{color:'rgba(30,136,229, 0.29)', width:2}},
  144. splitLine: {show: true, lineStyle:{width: 1.6, color: '#00093a', type:'dashed'}},
  145. data: ["语文","数学","英语","化学","政治","历史", '化学', '生物', '物理']
  146. },
  147. yAxis: {
  148. type: 'value',
  149. axisTick:{show:false},
  150. axisLabel:{color:'rgba(255,255,255, 0.61)'},
  151. axisLine:{lineStyle:{width:0}},
  152. splitLine: {show: true, lineStyle:{width: 2.7, color: '#17283e'}}
  153. },
  154. series: [{
  155. type:'line',
  156. symbol: 'circle', //设定为实心点
  157. symbolSize: 8, //设定实心点的大小
  158. smooth:true,//是否曲线
  159. itemStyle: {normal: {color: '#DC3169', lineStyle: {color: "#DC3169"}}},
  160. lineStyle: {normal: {width: 1.5}},
  161. areaStyle: {normal: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  162. {offset: 0, color: 'rgba(220, 49, 105, 0.35)'}, {offset: 1, color: 'rgba(0, 10, 59, 0.02)'}
  163. ])}},
  164. data: [88,96,163,270,300,112,215,300,198,398]
  165. }]
  166. });
  167. let radar = echarts.init(document.getElementById('radar'), null, {renderer: drawType});
  168. radar.setOption({
  169. backgroundColor: '',
  170. radar: [{
  171. indicator: [
  172. {text: '语文', color: '#ffffff', max: 1000},
  173. {text: '数学', color: '#ffffff', max: 1000},
  174. {text: '英语', color: '#ffffff', max: 1000},
  175. {text: '物理', color: '#ffffff', max: 1000},
  176. {text: '化学', color: '#ffffff', max: 1000},
  177. {text: '生物', color: '#ffffff', max: 1000},
  178. {text: '政治', color: '#ffffff', max: 1000},
  179. {text: '历史', color: '#ffffff', max: 1000},
  180. ],
  181. center: ['46%', '50%'], startAngle: 90, splitNumber: 5, shape: 'line',
  182. name: {formatter: '{value}', textStyle: {color: '#595959', fontSize: 13}},
  183. splitArea: {show: false, areaStyle: {color: 'rgba(0,0,0,0)'}},
  184. axisLine: {lineStyle: {color: 'rgba(128, 128, 128, 0)'}},
  185. splitLine: {lineStyle: {color: '#01C4F7',width: 2}},
  186. }],
  187. series: [{
  188. name: '雷达图',
  189. type: 'radar',
  190. itemStyle: {emphasis: {lineStyle: {width: 4}}},
  191. data: [{
  192. lineStyle: {normal: {opacity: 0}}, itemStyle: {normal: {opacity: 0}},
  193. areaStyle:{normal:{color: new echarts.graphic.RadialGradient(0.5, 0.5, 0.5,[{offset: 0, color: '#5CA1FF'},{offset: 1, color: '#0162E7'}],false)}},
  194. value: [100, 200, 300, 400, 500, 600, 700, 1000],
  195. }]
  196. }]
  197. });
  198. radar.resize()
  199. </script>
  200. </body>
  201. </html>