js.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. 
  2. $(function () {
  3. echarts_1();
  4. echarts_2();
  5. echarts_4();
  6. echarts_31();
  7. echarts_32();
  8. echarts_33();
  9. echarts_5();
  10. echarts_6();
  11. function echarts_1() {
  12. // 基于准备好的dom,初始化echarts实例
  13. var myChart = echarts.init(document.getElementById('echart1'));
  14. option = {
  15. // backgroundColor: '#00265f',
  16. tooltip: {
  17. trigger: 'axis',
  18. axisPointer: {
  19. type: 'shadow'
  20. }
  21. },
  22. grid: {
  23. left: '0%',
  24. top:'10px',
  25. right: '0%',
  26. bottom: '4%',
  27. containLabel: true
  28. },
  29. xAxis: [{
  30. type: 'category',
  31. data: ['商超门店', '教育培训', '房地产', '生活服务', '汽车销售', '旅游酒店', '五金建材'],
  32. axisLine: {
  33. show: true,
  34. lineStyle: {
  35. color: "rgba(255,255,255,.1)",
  36. width: 1,
  37. type: "solid"
  38. },
  39. },
  40. axisTick: {
  41. show: false,
  42. },
  43. axisLabel: {
  44. interval: 0,
  45. // rotate:50,
  46. show: true,
  47. splitNumber: 15,
  48. textStyle: {
  49. color: "rgba(255,255,255,.6)",
  50. fontSize: '12',
  51. },
  52. },
  53. }],
  54. yAxis: [{
  55. type: 'value',
  56. axisLabel: {
  57. //formatter: '{value} %'
  58. show:true,
  59. textStyle: {
  60. color: "rgba(255,255,255,.6)",
  61. fontSize: '12',
  62. },
  63. },
  64. axisTick: {
  65. show: false,
  66. },
  67. axisLine: {
  68. show: true,
  69. lineStyle: {
  70. color: "rgba(255,255,255,.1 )",
  71. width: 1,
  72. type: "solid"
  73. },
  74. },
  75. splitLine: {
  76. lineStyle: {
  77. color: "rgba(255,255,255,.1)",
  78. }
  79. }
  80. }],
  81. series: [
  82. {
  83. type: 'bar',
  84. data: [200, 300, 300, 900, 1500, 1200, 600],
  85. barWidth:'35%', //柱子宽度
  86. // barGap: 1, //柱子之间间距
  87. itemStyle: {
  88. normal: {
  89. color:'#2f89cf',
  90. opacity: 1,
  91. barBorderRadius: 5,
  92. }
  93. }
  94. }
  95. ]
  96. };
  97. // 使用刚指定的配置项和数据显示图表。
  98. myChart.setOption(option);
  99. window.addEventListener("resize",function(){
  100. myChart.resize();
  101. });
  102. }
  103. function echarts_2() {
  104. // 基于准备好的dom,初始化echarts实例
  105. var myChart = echarts.init(document.getElementById('echart2'));
  106. option = {
  107. // backgroundColor: '#00265f',
  108. tooltip: {
  109. trigger: 'axis',
  110. axisPointer: { type: 'shadow'}
  111. },
  112. grid: {
  113. left: '0%',
  114. top:'10px',
  115. right: '0%',
  116. bottom: '4%',
  117. containLabel: true
  118. },
  119. xAxis: [{
  120. type: 'category',
  121. data: ['浙江', '上海', '江苏', '广东', '北京', '深圳', '安徽'],
  122. axisLine: {
  123. show: true,
  124. lineStyle: {
  125. color: "rgba(255,255,255,.1)",
  126. width: 1,
  127. type: "solid"
  128. },
  129. },
  130. axisTick: {
  131. show: false,
  132. },
  133. axisLabel: {
  134. interval: 0,
  135. // rotate:50,
  136. show: true,
  137. splitNumber: 15,
  138. textStyle: {
  139. color: "rgba(255,255,255,.6)",
  140. fontSize: '12',
  141. },
  142. },
  143. }],
  144. yAxis: [{
  145. type: 'value',
  146. axisLabel: {
  147. //formatter: '{value} %'
  148. show:true,
  149. textStyle: {
  150. color: "rgba(255,255,255,.6)",
  151. fontSize: '12',
  152. },
  153. },
  154. axisTick: {
  155. show: false,
  156. },
  157. axisLine: {
  158. show: true,
  159. lineStyle: {
  160. color: "rgba(255,255,255,.1 )",
  161. width: 1,
  162. type: "solid"
  163. },
  164. },
  165. splitLine: {
  166. lineStyle: {
  167. color: "rgba(255,255,255,.1)",
  168. }
  169. }
  170. }],
  171. series: [
  172. {
  173. type: 'bar',
  174. data: [1500, 1200, 600, 200, 300, 300, 900],
  175. barWidth:'35%', //柱子宽度
  176. // barGap: 1, //柱子之间间距
  177. itemStyle: {
  178. normal: {
  179. color:'#27d08a',
  180. opacity: 1,
  181. barBorderRadius: 5,
  182. }
  183. }
  184. }
  185. ]
  186. };
  187. // 使用刚指定的配置项和数据显示图表。
  188. myChart.setOption(option);
  189. window.addEventListener("resize",function(){
  190. myChart.resize();
  191. });
  192. }
  193. function echarts_5() {
  194. // 基于准备好的dom,初始化echarts实例
  195. var myChart = echarts.init(document.getElementById('echart5'));
  196. option = {
  197. // backgroundColor: '#00265f',
  198. tooltip: {
  199. trigger: 'axis',
  200. axisPointer: {
  201. type: 'shadow'
  202. }
  203. },
  204. grid: {
  205. left: '0%',
  206. top:'10px',
  207. right: '0%',
  208. bottom: '2%',
  209. containLabel: true
  210. },
  211. xAxis: [{
  212. type: 'category',
  213. data: ['浙江', '上海', '江苏', '广东', '北京', '深圳', '安徽', '四川'],
  214. axisLine: {
  215. show: true,
  216. lineStyle: {
  217. color: "rgba(255,255,255,.1)",
  218. width: 1,
  219. type: "solid"
  220. },
  221. },
  222. axisTick: {
  223. show: false,
  224. },
  225. axisLabel: {
  226. interval: 0,
  227. // rotate:50,
  228. show: true,
  229. splitNumber: 15,
  230. textStyle: {
  231. color: "rgba(255,255,255,.6)",
  232. fontSize: '12',
  233. },
  234. },
  235. }],
  236. yAxis: [{
  237. type: 'value',
  238. axisLabel: {
  239. //formatter: '{value} %'
  240. show:true,
  241. textStyle: {
  242. color: "rgba(255,255,255,.6)",
  243. fontSize: '12',
  244. },
  245. },
  246. axisTick: {
  247. show: false,
  248. },
  249. axisLine: {
  250. show: true,
  251. lineStyle: {
  252. color: "rgba(255,255,255,.1 )",
  253. width: 1,
  254. type: "solid"
  255. },
  256. },
  257. splitLine: {
  258. lineStyle: {
  259. color: "rgba(255,255,255,.1)",
  260. }
  261. }
  262. }],
  263. series: [{
  264. type: 'bar',
  265. data: [2, 3, 3, 9, 15, 12, 6, 4, 6, 7, 4, 10],
  266. barWidth:'35%', //柱子宽度
  267. // barGap: 1, //柱子之间间距
  268. itemStyle: {
  269. normal: {
  270. color:'#2f89cf',
  271. opacity: 1,
  272. barBorderRadius: 5,
  273. }
  274. }
  275. }
  276. ]
  277. };
  278. // 使用刚指定的配置项和数据显示图表。
  279. myChart.setOption(option);
  280. window.addEventListener("resize",function(){
  281. myChart.resize();
  282. });
  283. }
  284. function echarts_4() {
  285. // 基于准备好的dom,初始化echarts实例
  286. var myChart = echarts.init(document.getElementById('echart4'));
  287. option = {
  288. tooltip: {
  289. trigger: 'axis',
  290. axisPointer: {
  291. lineStyle: {
  292. color: '#dddc6b'
  293. }
  294. }
  295. },
  296. legend: {
  297. top:'0%',
  298. data:['安卓','IOS'],
  299. textStyle: {
  300. color: 'rgba(255,255,255,.5)',
  301. fontSize:'12',
  302. }
  303. },
  304. grid: {
  305. left: '10',
  306. top: '30',
  307. right: '10',
  308. bottom: '10',
  309. containLabel: true
  310. },
  311. xAxis: [{
  312. type: 'category',
  313. boundaryGap: false,
  314. axisLabel: {
  315. textStyle: {
  316. color: "rgba(255,255,255,.6)",
  317. fontSize:12,
  318. },
  319. },
  320. axisLine: {
  321. lineStyle: {
  322. color: 'rgba(255,255,255,.2)'
  323. }
  324. },
  325. data: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']
  326. }, {
  327. axisPointer: {show: false},
  328. axisLine: { show: false},
  329. position: 'bottom',
  330. offset: 20,
  331. }],
  332. yAxis: [{
  333. type: 'value',
  334. axisTick: {show: false},
  335. axisLine: {
  336. lineStyle: {
  337. color: 'rgba(255,255,255,.1)'
  338. }
  339. },
  340. axisLabel: {
  341. textStyle: {
  342. color: "rgba(255,255,255,.6)",
  343. fontSize:12,
  344. },
  345. },
  346. splitLine: {
  347. lineStyle: {
  348. color: 'rgba(255,255,255,.1)'
  349. }
  350. }
  351. }],
  352. series: [
  353. {
  354. name: '安卓',
  355. type: 'line',
  356. smooth: true,
  357. symbol: 'circle',
  358. symbolSize: 5,
  359. showSymbol: false,
  360. lineStyle: {
  361. normal: {
  362. color: '#0184d5',
  363. width: 2
  364. }
  365. },
  366. areaStyle: {
  367. normal: {
  368. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  369. offset: 0,
  370. color: 'rgba(1, 132, 213, 0.4)'
  371. }, {
  372. offset: 0.8,
  373. color: 'rgba(1, 132, 213, 0.1)'
  374. }], false),
  375. shadowColor: 'rgba(0, 0, 0, 0.1)',
  376. }
  377. },
  378. itemStyle: {
  379. normal: {
  380. color: '#0184d5',
  381. borderColor: 'rgba(221, 220, 107, .1)',
  382. borderWidth: 12
  383. }
  384. },
  385. data: [3, 4, 3, 4, 3, 4, 3, 6, 2, 4, 2, 4,3, 4, 3, 4, 3, 4, 3, 6, 2, 4, 2, 4]
  386. },
  387. {
  388. name: 'IOS',
  389. type: 'line',
  390. smooth: true,
  391. symbol: 'circle',
  392. symbolSize: 5,
  393. showSymbol: false,
  394. lineStyle: {
  395. normal: {
  396. color: '#00d887',
  397. width: 2
  398. }
  399. },
  400. areaStyle: {
  401. normal: {
  402. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  403. offset: 0,
  404. color: 'rgba(0, 216, 135, 0.4)'
  405. }, {
  406. offset: 0.8,
  407. color: 'rgba(0, 216, 135, 0.1)'
  408. }], false),
  409. shadowColor: 'rgba(0, 0, 0, 0.1)',
  410. }
  411. },
  412. itemStyle: {
  413. normal: {
  414. color: '#00d887',
  415. borderColor: 'rgba(221, 220, 107, .1)',
  416. borderWidth: 12
  417. }
  418. },
  419. data: [5, 3, 5, 6, 1, 5, 3, 5, 6, 4, 6, 4, 8, 3, 5, 6, 1, 5, 3, 7, 2, 5, 1, 4]
  420. },
  421. ]
  422. };
  423. // 使用刚指定的配置项和数据显示图表。
  424. myChart.setOption(option);
  425. window.addEventListener("resize",function(){
  426. myChart.resize();
  427. });
  428. }
  429. function echarts_6() {
  430. // 基于准备好的dom,初始化echarts实例
  431. var myChart = echarts.init(document.getElementById('echart6'));
  432. var dataStyle = {
  433. normal: {
  434. label: {
  435. show: false
  436. },
  437. labelLine: {
  438. show: false
  439. },
  440. //shadowBlur: 40,
  441. //shadowColor: 'rgba(40, 40, 40, 1)',
  442. }
  443. };
  444. var placeHolderStyle = {
  445. normal: {
  446. color: 'rgba(255,255,255,.05)',
  447. label: {show: false,},
  448. labelLine: {show: false}
  449. },
  450. emphasis: {
  451. color: 'rgba(0,0,0,0)'
  452. }
  453. };
  454. option = {
  455. color: ['#0f63d6', '#0f78d6', '#0f8cd6', '#0fa0d6', '#0fb4d6'],
  456. tooltip: {
  457. show: true,
  458. formatter: "{a} : {c} "
  459. },
  460. legend: {
  461. itemWidth: 10,
  462. itemHeight: 10,
  463. itemGap: 12,
  464. bottom: '3%',
  465. data: ['浙江', '上海', '广东', '北京', '深圳'],
  466. textStyle: {
  467. color: 'rgba(255,255,255,.6)',
  468. }
  469. },
  470. series: [
  471. {
  472. name: '浙江',
  473. type: 'pie',
  474. clockWise: false,
  475. center: ['50%', '42%'],
  476. radius: ['59%', '70%'],
  477. itemStyle: dataStyle,
  478. hoverAnimation: false,
  479. data: [{
  480. value: 80,
  481. name: '01'
  482. }, {
  483. value: 20,
  484. name: 'invisible',
  485. tooltip: {show: false},
  486. itemStyle: placeHolderStyle
  487. }]
  488. },
  489. {
  490. name: '上海',
  491. type: 'pie',
  492. clockWise: false,
  493. center: ['50%', '42%'],
  494. radius: ['49%', '60%'],
  495. itemStyle: dataStyle,
  496. hoverAnimation: false,
  497. data: [{
  498. value: 70,
  499. name: '02'
  500. }, {
  501. value: 30,
  502. name: 'invisible',
  503. tooltip: {show: false},
  504. itemStyle: placeHolderStyle
  505. }]
  506. },
  507. {
  508. name: '广东',
  509. type: 'pie',
  510. clockWise: false,
  511. hoverAnimation: false,
  512. center: ['50%', '42%'],
  513. radius: ['39%', '50%'],
  514. itemStyle: dataStyle,
  515. data: [{
  516. value: 65,
  517. name: '03'
  518. }, {
  519. value: 35,
  520. name: 'invisible',
  521. tooltip: {show: false},
  522. itemStyle: placeHolderStyle
  523. }]
  524. },
  525. {
  526. name: '北京',
  527. type: 'pie',
  528. clockWise: false,
  529. hoverAnimation: false,
  530. center: ['50%', '42%'],
  531. radius: ['29%', '40%'],
  532. itemStyle: dataStyle,
  533. data: [{
  534. value: 60,
  535. name: '04'
  536. }, {
  537. value: 40,
  538. name: 'invisible',
  539. tooltip: {show: false},
  540. itemStyle: placeHolderStyle
  541. }]
  542. },
  543. {
  544. name: '深圳',
  545. type: 'pie',
  546. clockWise: false,
  547. hoverAnimation: false,
  548. center: ['50%', '42%'],
  549. radius: ['20%', '30%'],
  550. itemStyle: dataStyle,
  551. data: [{
  552. value: 50,
  553. name: '05'
  554. }, {
  555. value: 50,
  556. name: 'invisible',
  557. tooltip: {show: false},
  558. itemStyle: placeHolderStyle
  559. }]
  560. }, ]
  561. };
  562. // 使用刚指定的配置项和数据显示图表。
  563. myChart.setOption(option);
  564. window.addEventListener("resize",function(){
  565. myChart.resize();
  566. });
  567. }
  568. function echarts_31() {
  569. // 基于准备好的dom,初始化echarts实例
  570. var myChart = echarts.init(document.getElementById('fb1'));
  571. option = {
  572. title: [{
  573. text: '年龄分布',
  574. left: 'center',
  575. textStyle: {
  576. color: '#fff',
  577. fontSize:'16'
  578. }
  579. }],
  580. tooltip: {
  581. trigger: 'item',
  582. formatter: "{a} <br/>{b}: {c} ({d}%)",
  583. position:function(p){ //其中p为当前鼠标的位置
  584. return [p[0] + 10, p[1] - 10];
  585. }
  586. },
  587. legend: {
  588. top:'70%',
  589. itemWidth: 10,
  590. itemHeight: 10,
  591. data:['0岁以下','20-29岁','30-39岁','40-49岁','50岁以上'],
  592. textStyle: {
  593. color: 'rgba(255,255,255,.5)',
  594. fontSize:'12',
  595. }
  596. },
  597. series: [
  598. {
  599. name:'年龄分布',
  600. type:'pie',
  601. center: ['50%', '42%'],
  602. radius: ['40%', '60%'],
  603. color: ['#065aab', '#066eab', '#0682ab', '#0696ab', '#06a0ab','#06b4ab','#06c8ab','#06dcab','#06f0ab'],
  604. label: {show:false},
  605. labelLine: {show:false},
  606. data:[
  607. {value:1, name:'0岁以下'},
  608. {value:4, name:'20-29岁'},
  609. {value:2, name:'30-39岁'},
  610. {value:2, name:'40-49岁'},
  611. {value:1, name:'50岁以上'},
  612. ]
  613. }
  614. ]
  615. };
  616. // 使用刚指定的配置项和数据显示图表。
  617. myChart.setOption(option);
  618. window.addEventListener("resize",function(){
  619. myChart.resize();
  620. });
  621. }
  622. function echarts_32() {
  623. // 基于准备好的dom,初始化echarts实例
  624. var myChart = echarts.init(document.getElementById('fb2'));
  625. option = {
  626. title: [{
  627. text: '职业分布',
  628. left: 'center',
  629. textStyle: {
  630. color: '#fff',
  631. fontSize:'16'
  632. }
  633. }],
  634. tooltip: {
  635. trigger: 'item',
  636. formatter: "{a} <br/>{b}: {c} ({d}%)",
  637. position:function(p){ //其中p为当前鼠标的位置
  638. return [p[0] + 10, p[1] - 10];
  639. }
  640. },
  641. legend: {
  642. top:'70%',
  643. itemWidth: 10,
  644. itemHeight: 10,
  645. data:['电子商务','教育','IT/互联网','金融','学生','其他'],
  646. textStyle: {
  647. color: 'rgba(255,255,255,.5)',
  648. fontSize:'12',
  649. }
  650. },
  651. series: [
  652. {
  653. name:'年龄分布',
  654. type:'pie',
  655. center: ['50%', '42%'],
  656. radius: ['40%', '60%'],
  657. color: ['#065aab', '#066eab', '#0682ab', '#0696ab', '#06a0ab','#06b4ab','#06c8ab','#06dcab','#06f0ab'],
  658. label: {show:false},
  659. labelLine: {show:false},
  660. data:[
  661. {value:5, name:'电子商务'},
  662. {value:1, name:'教育'},
  663. {value:6, name:'IT/互联网'},
  664. {value:2, name:'金融'},
  665. {value:1, name:'学生'},
  666. {value:1, name:'其他'},
  667. ]
  668. }
  669. ]
  670. };
  671. // 使用刚指定的配置项和数据显示图表。
  672. myChart.setOption(option);
  673. window.addEventListener("resize",function(){
  674. myChart.resize();
  675. });
  676. }
  677. function echarts_33() {
  678. // 基于准备好的dom,初始化echarts实例
  679. var myChart = echarts.init(document.getElementById('fb3'));
  680. option = {
  681. title: [{
  682. text: '兴趣分布',
  683. left: 'center',
  684. textStyle: {
  685. color: '#fff',
  686. fontSize:'16'
  687. }
  688. }],
  689. tooltip: {
  690. trigger: 'item',
  691. formatter: "{a} <br/>{b}: {c} ({d}%)",
  692. position:function(p){ //其中p为当前鼠标的位置
  693. return [p[0] + 10, p[1] - 10];
  694. }
  695. },
  696. legend: {
  697. top:'70%',
  698. itemWidth: 10,
  699. itemHeight: 10,
  700. data:['汽车','旅游','财经','教育','软件','其他'],
  701. textStyle: {
  702. color: 'rgba(255,255,255,.5)',
  703. fontSize:'12',
  704. }
  705. },
  706. series: [
  707. {
  708. name:'兴趣分布',
  709. type:'pie',
  710. center: ['50%', '42%'],
  711. radius: ['40%', '60%'],
  712. color: ['#065aab', '#066eab', '#0682ab', '#0696ab', '#06a0ab','#06b4ab','#06c8ab','#06dcab','#06f0ab'],
  713. label: {show:false},
  714. labelLine: {show:false},
  715. data:[
  716. {value:2, name:'汽车'},
  717. {value:3, name:'旅游'},
  718. {value:1, name:'财经'},
  719. {value:4, name:'教育'},
  720. {value:8, name:'软件'},
  721. {value:1, name:'其他'},
  722. ]
  723. }
  724. ]
  725. };
  726. // 使用刚指定的配置项和数据显示图表。
  727. myChart.setOption(option);
  728. window.addEventListener("resize",function(){
  729. myChart.resize();
  730. });
  731. }
  732. })