js.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. $(function () {
  2. echarts_1();
  3. echarts_2();
  4. echarts_3();
  5. echarts_4();
  6. echarts_5();
  7. echarts_6();
  8. echarts_7();
  9. echarts_8();
  10. function echarts_1() {
  11. // 基于准备好的dom,初始化echarts实例
  12. var myChart = echarts.init(document.getElementById('echart1'));
  13. option = {
  14. title: {
  15. text: '14%',
  16. x: 'center',
  17. y: 'center',
  18. textStyle: {
  19. fontWeight: 'normal',
  20. color: '#0580f2',
  21. fontSize: '24'
  22. }
  23. },
  24. color: ['rgba(176, 212, 251, .1)'],
  25. series: [{
  26. name: 'Line 1',
  27. type: 'pie',
  28. clockWise: true,
  29. radius: ['75%', '85%'],
  30. itemStyle: {
  31. normal: {
  32. label: {show: false},
  33. labelLine: {show: false},
  34. }
  35. },
  36. hoverAnimation: false,
  37. data: [{
  38. value: 14,
  39. name: '01',
  40. itemStyle: {
  41. normal: {
  42. color: { // 完成的圆环的颜色
  43. colorStops: [{
  44. offset: 0,
  45. color: '#00cefc' // 0% 处的颜色
  46. }, {
  47. offset: 1,
  48. color: '#367bec' // 100% 处的颜色
  49. }]
  50. },
  51. label: {show: false},
  52. labelLine: {show: false}
  53. }
  54. }
  55. }, {
  56. name: '86',
  57. value: 20
  58. }]
  59. }]
  60. }
  61. // 使用刚指定的配置项和数据显示图表。
  62. myChart.setOption(option);
  63. window.addEventListener("resize",function(){
  64. myChart.resize();
  65. });
  66. }
  67. function echarts_2() {
  68. // 基于准备好的dom,初始化echarts实例
  69. var myChart = echarts.init(document.getElementById('echart2'));
  70. option = {
  71. title: {
  72. text: '22%',
  73. x: 'center',
  74. y: 'center',
  75. textStyle: {
  76. fontWeight: 'normal',
  77. color: '#0580f2',
  78. fontSize: '24'
  79. }
  80. },
  81. color: ['rgba(176, 212, 251, .1)'],
  82. series: [{
  83. name: 'Line 1',
  84. type: 'pie',
  85. clockWise: true,
  86. radius: ['75%', '85%'],
  87. itemStyle: {
  88. normal: {
  89. label: {show: false},
  90. labelLine: {show: false},
  91. }
  92. },
  93. hoverAnimation: false,
  94. data: [{
  95. value: 22,
  96. name: '01',
  97. itemStyle: {
  98. normal: {
  99. color: { // 完成的圆环的颜色
  100. colorStops: [{
  101. offset: 0,
  102. color: '#00cefc' // 0% 处的颜色
  103. }, {
  104. offset: 1,
  105. color: '#367bec' // 100% 处的颜色
  106. }]
  107. },
  108. label: {show: false},
  109. labelLine: {show: false}
  110. }
  111. }
  112. }, {
  113. name: '78',
  114. value: 20
  115. }]
  116. }]
  117. }
  118. // 使用刚指定的配置项和数据显示图表。
  119. myChart.setOption(option);
  120. window.addEventListener("resize",function(){
  121. myChart.resize();
  122. });
  123. }
  124. function echarts_3() {
  125. // 基于准备好的dom,初始化echarts实例
  126. var myChart = echarts.init(document.getElementById('echart3'));
  127. option = {
  128. title: {
  129. text: '10%',
  130. x: 'center',
  131. y: 'center',
  132. textStyle: {
  133. fontWeight: 'normal',
  134. color: '#0580f2',
  135. fontSize: '24'
  136. }
  137. },
  138. color: ['rgba(176, 212, 251, .1)'],
  139. series: [{
  140. name: 'Line 1',
  141. type: 'pie',
  142. clockWise: true,
  143. radius: ['75%', '85%'],
  144. itemStyle: {
  145. normal: {
  146. label: {show: false},
  147. labelLine: {show: false},
  148. }
  149. },
  150. hoverAnimation: false,
  151. data: [{
  152. value: 10,
  153. name: '01',
  154. itemStyle: {
  155. normal: {
  156. color: { // 完成的圆环的颜色
  157. colorStops: [{
  158. offset: 0,
  159. color: '#00cefc' // 0% 处的颜色
  160. }, {
  161. offset: 1,
  162. color: '#367bec' // 100% 处的颜色
  163. }]
  164. },
  165. label: {show: false},
  166. labelLine: {show: false}
  167. }
  168. }
  169. }, {
  170. name: '02',
  171. value: 90
  172. }]
  173. }]
  174. }
  175. // 使用刚指定的配置项和数据显示图表。
  176. myChart.setOption(option);
  177. window.addEventListener("resize",function(){
  178. myChart.resize();
  179. });
  180. }
  181. function echarts_4() {
  182. // 基于准备好的dom,初始化echarts实例
  183. var myChart = echarts.init(document.getElementById('echart4'));
  184. option = {
  185. title: {
  186. text: '30%',
  187. x: 'center',
  188. y: 'center',
  189. textStyle: {
  190. fontWeight: 'normal',
  191. color: '#0580f2',
  192. fontSize: '24'
  193. }
  194. },
  195. color: ['rgba(176, 212, 251, .1)'],
  196. series: [{
  197. name: 'Line 1',
  198. type: 'pie',
  199. clockWise: true,
  200. radius: ['75%', '85%'],
  201. itemStyle: {
  202. normal: {
  203. label: {show: false},
  204. labelLine: {show: false},
  205. }
  206. },
  207. hoverAnimation: false,
  208. data: [{
  209. value: 30,
  210. name: '01',
  211. itemStyle: {
  212. normal: {
  213. color: { // 完成的圆环的颜色
  214. colorStops: [{
  215. offset: 0,
  216. color: '#00cefc' // 0% 处的颜色
  217. }, {
  218. offset: 1,
  219. color: '#367bec' // 100% 处的颜色
  220. }]
  221. },
  222. label: {show: false},
  223. labelLine: {show: false}
  224. }
  225. }
  226. }, {
  227. name: '02',
  228. value: 70
  229. }]
  230. }]
  231. }
  232. // 使用刚指定的配置项和数据显示图表。
  233. myChart.setOption(option);
  234. window.addEventListener("resize",function(){
  235. myChart.resize();
  236. });
  237. }
  238. function echarts_5() {
  239. // 基于准备好的dom,初始化echarts实例
  240. var myChart = echarts.init(document.getElementById('echart5'));
  241. option = {
  242. title: {
  243. text: '12%',
  244. x: 'center',
  245. y: 'center',
  246. textStyle: {
  247. fontWeight: 'normal',
  248. color: '#0580f2',
  249. fontSize: '24'
  250. }
  251. },
  252. color: ['rgba(176, 212, 251, .1)'],
  253. series: [{
  254. name: 'Line 1',
  255. type: 'pie',
  256. clockWise: true,
  257. radius: ['75%', '85%'],
  258. itemStyle: {
  259. normal: {
  260. label: {show: false},
  261. labelLine: {show: false},
  262. }
  263. },
  264. hoverAnimation: false,
  265. data: [{
  266. value: 12,
  267. name: '01',
  268. itemStyle: {
  269. normal: {
  270. color: { // 完成的圆环的颜色
  271. colorStops: [{
  272. offset: 0,
  273. color: '#00cefc' // 0% 处的颜色
  274. }, {
  275. offset: 1,
  276. color: '#367bec' // 100% 处的颜色
  277. }]
  278. },
  279. label: {show: false},
  280. labelLine: {show: false}
  281. }
  282. }
  283. }, {
  284. name: '02',
  285. value: 88
  286. }]
  287. }]
  288. }
  289. // 使用刚指定的配置项和数据显示图表。
  290. myChart.setOption(option);
  291. window.addEventListener("resize",function(){
  292. myChart.resize();
  293. });
  294. }
  295. function echarts_6() {
  296. // 基于准备好的dom,初始化echarts实例
  297. var myChart = echarts.init(document.getElementById('echart6'));
  298. option = {
  299. title: {
  300. text: '80%',
  301. x: 'center',
  302. y: 'center',
  303. textStyle: {
  304. fontWeight: 'normal',
  305. color: '#0580f2',
  306. fontSize: '24'
  307. }
  308. },
  309. color: ['rgba(176, 212, 251, .1)'],
  310. series: [{
  311. name: 'Line 1',
  312. type: 'pie',
  313. clockWise: true,
  314. radius: ['75%', '85%'],
  315. itemStyle: {
  316. normal: {
  317. label: {show: false},
  318. labelLine: {show: false},
  319. }
  320. },
  321. hoverAnimation: false,
  322. data: [{
  323. value: 80,
  324. name: '01',
  325. itemStyle: {
  326. normal: {
  327. color: { // 完成的圆环的颜色
  328. colorStops: [{
  329. offset: 0,
  330. color: '#00cefc' // 0% 处的颜色
  331. }, {
  332. offset: 1,
  333. color: '#367bec' // 100% 处的颜色
  334. }]
  335. },
  336. label: {show: false},
  337. labelLine: {show: false}
  338. }
  339. }
  340. }, {
  341. name: '02',
  342. value: 20
  343. }]
  344. }]
  345. }
  346. // 使用刚指定的配置项和数据显示图表。
  347. myChart.setOption(option);
  348. window.addEventListener("resize",function(){
  349. myChart.resize();
  350. });
  351. }
  352. function echarts_7() {
  353. // 基于准备好的dom,初始化echarts实例
  354. var myChart = echarts.init(document.getElementById('echart7'));
  355. option = {
  356. tooltip: {
  357. trigger: 'axis',
  358. axisPointer: {
  359. type: 'shadow'
  360. }
  361. },
  362. grid: {
  363. left: '0%',
  364. top:'15px',
  365. right: '0%',
  366. bottom: '0%',
  367. containLabel: true
  368. },
  369. xAxis: {
  370. data: ['8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00'],
  371. axisLine: {show:false,},
  372. axisLabel: {
  373. color: '#fff',
  374. fontSize: 12
  375. }
  376. },
  377. yAxis: {
  378. name: "(人)",
  379. nameTextStyle: {
  380. color: '#fff',
  381. fontSize: 14
  382. },
  383. axisLine: { show:false, },
  384. axisLabel: {
  385. color: '#fff',
  386. fontSize: 12
  387. },
  388. splitLine: {show:false, },
  389. interval:100,
  390. max:500
  391. },
  392. series: [{
  393. type: 'bar',
  394. barWidth: '30%',
  395. itemStyle:{
  396. normal:{
  397. barBorderRadius: 50,
  398. color:new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  399. offset: 0,
  400. color: '#01fdcc'
  401. }, {
  402. offset: 0.8,
  403. color: '#11a1d8'
  404. }], false)
  405. }
  406. },
  407. data: [25, 325, 164, 245, 475, 201, 121]
  408. }]
  409. };
  410. // 使用刚指定的配置项和数据显示图表。
  411. myChart.setOption(option);
  412. window.addEventListener("resize",function(){
  413. myChart.resize();
  414. });
  415. }
  416. function echarts_8() {
  417. // 基于准备好的dom,初始化echarts实例
  418. var myChart = echarts.init(document.getElementById('echart8'));
  419. option = {
  420. color: ['#ec704a', '#2e4453', '#249cf9', '#fdb629', '#4b5cc4', '#f47983', '#8d4bbb', '#6635EF', '#FFAFDA'],
  421. tooltip: {
  422. trigger: 'item',
  423. formatter: "{a} <br/>{b}: {c} ({d}%)"
  424. },
  425. legend: {
  426. orient: 'vertical',
  427. right:0,
  428. y:'center',
  429. itemWidth: 12,
  430. itemHeight: 12,
  431. align: 'left',
  432. textStyle: {
  433. fontSize:12,
  434. color: '#fff'
  435. },
  436. data: ['test1','test2','test3','test4','test5'],
  437. },
  438. series: [
  439. {
  440. name: '访问来源',
  441. type: 'pie',
  442. center: ['50%', '50%'],
  443. radius: ['20%', '50%'],
  444. label: {
  445. normal: {
  446. formatter: '{c|{d}%}',
  447. rich: {
  448. c: {
  449. fontSize: 12,
  450. color: '#fff',
  451. }
  452. }
  453. }
  454. },
  455. labelLine: {
  456. normal: {
  457. show: true,
  458. length:2,
  459. length2:5,
  460. lineStyle: {
  461. width:1
  462. }
  463. }
  464. },
  465. roseType : 'area',
  466. data: [{
  467. value:10,
  468. name: 'test1'
  469. },
  470. {
  471. value: 20,
  472. name: 'test2'
  473. },
  474. {
  475. value: 5,
  476. name: 'test3'
  477. },
  478. {
  479. value:15,
  480. name: 'test4'
  481. },
  482. {
  483. value:15,
  484. name: 'test5'
  485. }
  486. ]
  487. }
  488. ]
  489. };
  490. // 使用刚指定的配置项和数据显示图表。
  491. myChart.setOption(option);
  492. window.addEventListener("resize",function(){
  493. myChart.resize();
  494. });
  495. }
  496. })