js.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1.  $(window).load(function(){
  2. $(".loading").fadeOut()
  3. })
  4. /****/
  5. $(document).ready(function(){
  6. var whei=$(window).width()
  7. $("html").css({fontSize:whei/20})
  8. $(window).resize(function(){
  9. var whei=$(window).width()
  10. $("html").css({fontSize:whei/20})
  11. });
  12. });
  13. $(window).load(function(){$(".loading").fadeOut()})
  14. $(function () {
  15. echarts_3()
  16. echarts_4()
  17. bt01()
  18. bt02()
  19. bt03()
  20. bt04()
  21. function echarts_4() {
  22. var myChart = echarts.init(document.getElementById('echart4'));
  23. option1= {
  24. // backgroundColor: '#00265f',
  25. tooltip: {
  26. trigger: 'axis',
  27. axisPointer: {
  28. type: 'shadow'
  29. }
  30. },
  31. legend: {
  32. data: ['字段名称1', '字段名称2'],
  33. top:'5%',
  34. textStyle: {
  35. color: "#fff",
  36. fontSize: '12',
  37. },
  38. //itemGap: 35
  39. },
  40. grid: {
  41. left: '0%',
  42. top:'40px',
  43. right: '0%',
  44. bottom: '0',
  45. containLabel: true
  46. },
  47. xAxis: [{
  48. type: 'category',
  49. data: ['1', '2', '3', '4', '5', '6', '7'],
  50. axisLine: {
  51. show: true,
  52. lineStyle: {
  53. color: "rgba(255,255,255,.1)",
  54. width: 1,
  55. type: "solid"
  56. },
  57. },
  58. axisTick: {
  59. show: false,
  60. },
  61. axisLabel: {
  62. interval: 0,
  63. // rotate:50,
  64. show: true,
  65. // splitNumber: 2,
  66. textStyle: {
  67. color: "rgba(255,255,255,.6)",
  68. fontSize: '12',
  69. },
  70. },
  71. }],
  72. yAxis: [
  73. {
  74. type: 'value',
  75. axisLabel: {
  76. //formatter: '{value} %'
  77. show:true,
  78. textStyle: {
  79. color: "rgba(255,255,255,.6)",
  80. fontSize: '12',
  81. },
  82. },
  83. axisTick: {
  84. show: false,
  85. },
  86. axisLine: {
  87. show: true,
  88. lineStyle: {
  89. color: "rgba(255,255,255,.1 )",
  90. width: 1,
  91. type: "solid"
  92. },
  93. },
  94. splitLine: {
  95. lineStyle: {
  96. color: "rgba(255,255,255,.1)",
  97. }
  98. }
  99. }],
  100. series: [
  101. {
  102. name: '字段名称1',
  103. type: 'line',
  104. smooth: true,
  105. data: [5, 2, 6, 4, 5, 12,20],
  106. barWidth:'15',
  107. // barGap: 1,
  108. itemStyle: {
  109. normal: {
  110. color:'#62c98d',
  111. opacity: 1,
  112. barBorderRadius: 5,
  113. }
  114. }
  115. },
  116. {
  117. name: '字段名称2',
  118. type: 'line',
  119. smooth: true,
  120. data: [7, 11, 8, 13, 10, 13,10],
  121. itemStyle: {
  122. normal: {
  123. color:'#ffc000',
  124. opacity: 1,
  125. barBorderRadius: 5,
  126. }
  127. }
  128. }
  129. ]
  130. };
  131. myChart.setOption(option1);
  132. window.addEventListener("resize",function(){
  133. myChart.resize();
  134. });
  135. $(".sebtn a").click(function(){
  136. $(this).addClass("active").siblings().removeClass("active")
  137. })
  138. $(".sebtn a").eq(0).click(function(){
  139. myChart.setOption(option1);
  140. })
  141. $(".sebtn a").eq(1).click(function(){
  142. myChart.setOption(option2);
  143. })
  144. $(".sebtn a").eq(2).click(function(){
  145. myChart.setOption(option3);
  146. })
  147. }
  148. function echarts_3() {
  149. var myChart = echarts.init(document.getElementById('echart3'));
  150. var spNum = 5,_max=100;
  151. var legendData = ['已完成', '未完成'];
  152. var y_data = ['字段名称1', '字段名称2', '字段名称3', '字段名称4'];
  153. var data1 = [10,15,100,13];
  154. var data2 = [19,50,40,33];
  155. var fomatter_fn = function(v) {
  156. return (v.value / _max * 100).toFixed(0)
  157. }
  158. var _label = {
  159. normal: {
  160. show: true,
  161. position: 'inside',
  162. formatter: fomatter_fn,
  163. textStyle: {
  164. color: '#fff',
  165. fontSize: 12
  166. }
  167. }
  168. };
  169. option = {
  170. grid: {
  171. containLabel: true,
  172. top: 10,
  173. left: 0,
  174. right: 15,
  175. bottom:-10
  176. },
  177. tooltip: {
  178. show: true,
  179. formatter:'{b}<br/>{a}:{c}'
  180. },
  181. xAxis: {
  182. splitNumber: spNum,
  183. // interval: _max / spNum,
  184. //max: _max,
  185. axisLabel: {
  186. show: false,
  187. formatter: function(v) {
  188. var _v = (v / _max * 100).toFixed(0);
  189. return _v == 0 ? _v : _v + '%';
  190. }
  191. },
  192. axisLine: {
  193. show: false
  194. },
  195. axisTick: {
  196. show: false
  197. },
  198. splitLine: {
  199. show: false
  200. }
  201. },
  202. yAxis: [{
  203. data: y_data,
  204. axisLabel: {
  205. fontSize: 14,
  206. color: 'rgba(255,255,255,.6)'
  207. },
  208. axisLine: {
  209. show: false
  210. },
  211. axisTick: {
  212. show: false
  213. },
  214. splitLine: {
  215. show: false
  216. }
  217. }, {
  218. show: false,
  219. data: y_data,
  220. axisLine: {
  221. show: false
  222. }
  223. }],
  224. series: [{
  225. type: 'bar',
  226. name: '已完成',
  227. stack: '2',
  228. label: _label,
  229. legendHoverLink: false, barWidth: '50%',
  230. itemStyle: {
  231. normal: {
  232. color: '#58c485'
  233. },
  234. emphasis: {
  235. color: '#58c485'
  236. }
  237. },
  238. data: data1
  239. }, {
  240. type: 'bar',
  241. name: '未完成',
  242. stack: '2',
  243. legendHoverLink: false, barWidth: '50%',
  244. label: _label,
  245. itemStyle: {
  246. normal: {
  247. color: '#ea7231'
  248. },
  249. emphasis: {
  250. color: '#ea7231'
  251. }
  252. },
  253. data: data2
  254. }]
  255. };
  256. myChart.setOption(option);
  257. window.addEventListener("resize",function(){
  258. myChart.resize();
  259. });
  260. }
  261. function bt01() {
  262. var myChart = echarts.init(document.getElementById('bt01'));
  263. var data1=104//己完成
  264. var data2=18//未完成
  265. var data3=data1/(data1+data2)*100
  266. option = {
  267. title: [{
  268. text: data3.toFixed(1)+'%',
  269. x: 'center', y: '54%',
  270. textStyle: {
  271. fontSize: 18,
  272. fontWeight: 'bold',
  273. fontStyle: 'normal',
  274. color: '#fff'
  275. }
  276. }, {
  277. text: '己完成',
  278. x: 'center', y: '68%',
  279. textStyle: {
  280. fontSize: 10,
  281. fontWeight: 'normal',
  282. fontStyle: 'normal',
  283. color: 'rgba(255,255,255,.6)'
  284. }
  285. }, {
  286. text: '字段名称4',
  287. x: 'center', y: '20',
  288. textStyle: {
  289. fontSize: 14,
  290. fontWeight: 'bold',
  291. color: '#fff'
  292. }
  293. }],
  294. tooltip: {
  295. trigger: 'item',
  296. formatter: '{a} <br/>{b}: {c} ({d}%)'
  297. },
  298. color: ['#58c485', '#ea7231'],
  299. series: [
  300. {
  301. name: '检点',
  302. type: 'pie', center: ['50%', '65%'], radius: ['45%', '60%'],
  303. startAngle: 360,
  304. avoidLabelOverlap: false,
  305. label: {
  306. normal: {
  307. show: false,
  308. position: 'center'
  309. },
  310. emphasis: {
  311. show: false,
  312. textStyle: {
  313. fontSize: '30',
  314. fontWeight: 'bold'
  315. }
  316. }
  317. },
  318. labelLine: {
  319. normal: {
  320. show: false
  321. }
  322. },
  323. data: [{
  324. value: data1,
  325. name: '己完成'
  326. },
  327. {
  328. value: data2,
  329. name: '未完成'
  330. },
  331. ]
  332. }]
  333. };
  334. myChart.setOption(option);
  335. window.addEventListener("resize",function(){
  336. myChart.resize();
  337. });
  338. }
  339. function bt02() {
  340. var myChart = echarts.init(document.getElementById('bt02'));
  341. var data1=14//己完成
  342. var data2=18//未完成
  343. var data3=data1/(data1+data2)*100
  344. option = {
  345. title: [{
  346. text: data3.toFixed(1)+'%',
  347. x: 'center', y: '54%',
  348. textStyle: {
  349. fontSize: 18,
  350. fontWeight: 'bold',
  351. fontStyle: 'normal',
  352. color: '#fff'
  353. }
  354. }, {
  355. text: '己完成',
  356. x: 'center', y: '68%',
  357. textStyle: {
  358. fontSize: 10,
  359. fontWeight: 'normal',
  360. fontStyle: 'normal',
  361. color: 'rgba(255,255,255,.6)'
  362. }
  363. }, {
  364. text: '字段名称1',
  365. x: 'center', y: '20',
  366. textStyle: {
  367. fontSize: 14,
  368. fontWeight: 'bold',
  369. color: '#fff'
  370. }
  371. }],
  372. tooltip: {
  373. trigger: 'item',
  374. formatter: '{a} <br/>{b}: {c} ({d}%)'
  375. },
  376. color: ['#58c485', '#ea7231'],
  377. series: [
  378. {
  379. name: '检点',
  380. type: 'pie', center: ['50%', '65%'], radius: ['45%', '60%'],
  381. startAngle: 360,
  382. avoidLabelOverlap: false,
  383. label: {
  384. normal: {
  385. show: false,
  386. position: 'center'
  387. },
  388. emphasis: {
  389. show: false,
  390. textStyle: {
  391. fontSize: '30',
  392. fontWeight: 'bold'
  393. }
  394. }
  395. },
  396. labelLine: {
  397. normal: {
  398. show: false
  399. }
  400. },
  401. data: [{
  402. value: data1,
  403. name: '己完成'
  404. },
  405. {
  406. value: data2,
  407. name: '未完成'
  408. },
  409. ]
  410. }]
  411. };
  412. myChart.setOption(option);
  413. window.addEventListener("resize",function(){
  414. myChart.resize();
  415. });
  416. }
  417. function bt03() {
  418. var myChart = echarts.init(document.getElementById('bt03'));
  419. var data1=104//己完成
  420. var data2=108//未完成
  421. var data3=data1/(data1+data2)*100
  422. option = {
  423. title: [ {
  424. text: data3.toFixed(1)+'%',
  425. x: 'center', y: '54%',
  426. textStyle: {
  427. fontSize: 18,
  428. fontWeight: 'bold',
  429. fontStyle: 'normal',
  430. color: '#fff'
  431. }
  432. },
  433. {
  434. text: '己完成',
  435. x: 'center', y: '68%',
  436. textStyle: {
  437. fontSize: 10,
  438. fontWeight: 'normal',
  439. fontStyle: 'normal',
  440. color: 'rgba(255,255,255,.6)'
  441. }
  442. }, {
  443. text: '字段名称2',
  444. x: 'center', y: '20',
  445. textStyle: {
  446. fontSize: 14,
  447. fontWeight: 'bold',
  448. color: '#fff'
  449. }
  450. }],
  451. tooltip: {
  452. trigger: 'item',
  453. formatter: '{a} <br/>{b}: {c} ({d}%)'
  454. },
  455. color: ['#58c485', '#ea7231'],
  456. series: [
  457. {
  458. name: '检点',
  459. type: 'pie', center: ['50%', '65%'], radius: ['45%', '60%'],
  460. startAngle: 360,
  461. avoidLabelOverlap: false,
  462. label: {show: false,
  463. },
  464. labelLine: {
  465. normal: {
  466. show: false
  467. }
  468. },
  469. data: [
  470. {
  471. value: data1,
  472. name: '己完成'
  473. },{
  474. value: data2,
  475. name: '未完成'
  476. },
  477. ]
  478. }]
  479. };
  480. myChart.setOption(option);
  481. window.addEventListener("resize",function(){
  482. myChart.resize();
  483. });
  484. }
  485. function bt04() {
  486. var myChart = echarts.init(document.getElementById('bt04'));
  487. var data1=1000//己完成
  488. var data2=552//未完成
  489. var data3=data1/(data1+data2)*100
  490. option = {
  491. title: [{
  492. text: data3.toFixed(1)+'%',
  493. x: 'center', y: '54%',
  494. textStyle: {
  495. fontSize: 18,
  496. fontWeight: 'bold',
  497. fontStyle: 'normal',
  498. color: '#fff'
  499. }
  500. }, {
  501. text: '己完成',
  502. x: 'center', y: '68%',
  503. textStyle: {
  504. fontSize: 10,
  505. fontWeight: 'normal',
  506. fontStyle: 'normal',
  507. color: 'rgba(255,255,255,.6)'
  508. }
  509. }, {
  510. text: '字段名称3',
  511. x: 'center',
  512. y: '20',
  513. textStyle: {
  514. fontSize: 14,
  515. fontWeight: 'bold',
  516. color: '#fff'
  517. }
  518. }],
  519. tooltip: {
  520. trigger: 'item',
  521. formatter: '{a} <br/>{b}: {c} ({d}%)'
  522. },
  523. color: ['#58c485', '#ea7231'],
  524. series: [
  525. {
  526. name: '检点',
  527. type: 'pie',
  528. center: ['50%', '65%'], radius: ['45%', '60%'],
  529. startAngle: 360,
  530. avoidLabelOverlap: false,
  531. label: {
  532. normal: {
  533. show: false,
  534. position: 'center'
  535. },
  536. emphasis: {
  537. show: false,
  538. textStyle: {
  539. fontSize: '30',
  540. fontWeight: 'bold'
  541. }
  542. }
  543. },
  544. labelLine: {
  545. normal: {
  546. show: false
  547. }
  548. },
  549. data: [{
  550. value: data1,
  551. name: '己完成'
  552. },
  553. {
  554. value: data2,
  555. name: '未完成'
  556. },
  557. ]
  558. }]
  559. };
  560. myChart.setOption(option);
  561. window.addEventListener("resize",function(){
  562. myChart.resize();
  563. });
  564. }
  565. })