js.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999
  1.  $(window).load(function(){$(".loading").fadeOut()})
  2. $(function () {
  3. echarts_6();
  4. echarts_5();
  5. echarts_4();
  6. echarts_1();
  7. echarts_2();
  8. echarts_3();
  9. echarts_7();
  10. function echarts_1() {
  11. // 基于准备好的dom,初始化echarts实例
  12. var myChart = echarts.init(document.getElementById('echart1'));
  13. option = {
  14. legend: {
  15. //orient: 'vertical',
  16. top:'20',
  17. left:'center',
  18. itemWidth: 10,
  19. itemHeight: 10,
  20. data:['服装','娱乐','食品','海鲜'],
  21. textStyle: {
  22. color: 'rgba(255,255,255,.5)',
  23. fontSize:'12',
  24. }
  25. },
  26. tooltip: {
  27. trigger: 'item',
  28. formatter: "{b} : {c} ({d}%)"
  29. },
  30. visualMap: {
  31. show: false,
  32. min: 500,
  33. max: 600,
  34. inRange: {
  35. //colorLightness: [0, 1]
  36. }
  37. },
  38. series: [{
  39. name: '分布',
  40. type: 'pie',
  41. radius: ['30%', '60%'],
  42. center: ['50%', '60%'],
  43. color: ['#0086e5', '#30c5ed', '#9fe7b8', '#fedb5b', '#ff9f7d', '#fb7293', '#e7bcf2'], //'#FBFE27','rgb(11,228,96)','#FE5050'
  44. data: [{
  45. value: 10,
  46. name: '服装'
  47. },
  48. {
  49. value: 40,
  50. name: '娱乐'
  51. },
  52. {
  53. value: 20,
  54. name: '食品'
  55. },
  56. {
  57. value: 30,
  58. name: '海鲜'
  59. }
  60. ].sort(function(a, b) {
  61. return a.value - b.value
  62. }),
  63. roseType: 'radius',
  64. label: {
  65. normal: {
  66. formatter: ['{d|{d}%}', '{b|{b}}'].join('\n'),
  67. rich: {
  68. d: {
  69. color: 'rgb(241,246,104)',
  70. fontSize: 14,
  71. fontWeight:'bold',
  72. },
  73. b: {
  74. color: 'rgb(98,137,169)',
  75. fontSize: 12,
  76. },
  77. },
  78. }
  79. },
  80. labelLine: {
  81. normal: {
  82. lineStyle: {
  83. color: 'rgb(98,137,169)',
  84. },
  85. smooth: 0.2,
  86. length: 5,
  87. length2: 9,
  88. }
  89. },
  90. itemStyle: {
  91. normal: {
  92. shadowColor: 'rgba(0, 0, 0, 0.1)',
  93. shadowBlur: 50,
  94. }
  95. }
  96. }]
  97. };
  98. // 使用刚指定的配置项和数据显示图表。
  99. myChart.setOption(option);
  100. window.addEventListener("resize",function(){
  101. myChart.resize();
  102. });
  103. }
  104. function echarts_2() {
  105. var myChart = echarts.init(document.getElementById('echart2'));
  106. data = [{
  107. name: "数据1",
  108. value: 1000
  109. }, {
  110. name: "数据2",
  111. value: 2000
  112. }, {
  113. name: "数据3",
  114. value: 200
  115. }, {
  116. name: "数据4",
  117. value: 500
  118. }
  119. ];
  120. arrName = getArrayValue(data, "name");
  121. arrValue = getArrayValue(data, "value");
  122. sumValue = eval(arrValue.join('+'));
  123. objData = array2obj(data, "name");
  124. optionData = getData(data);
  125. function getArrayValue(array, key) {
  126. var key = key || "value";
  127. var res = [];
  128. if (array) {
  129. array.forEach(function(t) {
  130. res.push(t[key])
  131. })
  132. }
  133. return res
  134. }
  135. function array2obj(array, key) {
  136. var resObj = {};
  137. for (var i = 0; i < array.length; i++) {
  138. resObj[array[i][key]] = array[i]
  139. }
  140. return resObj
  141. }
  142. function getData(data) {
  143. var res = {
  144. series: [],
  145. yAxis: []
  146. };
  147. for (let i = 0; i < data.length; i++) {
  148. res.series.push({
  149. name: '数据',
  150. type: 'pie',
  151. clockWise: false,
  152. hoverAnimation: false,
  153. radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
  154. center: ["50%", "65%"],
  155. label: {
  156. show: false
  157. },
  158. itemStyle: {
  159. label: {
  160. show: false,
  161. },
  162. labelLine: {
  163. show: false
  164. },
  165. borderWidth: 5,
  166. },
  167. data: [{
  168. value: data[i].value,
  169. name: data[i].name
  170. }, {
  171. value: sumValue - data[i].value,
  172. name: '',
  173. itemStyle: {
  174. color: "rgba(0,0,0,0)",
  175. borderWidth: 0
  176. },
  177. tooltip: {
  178. show: false
  179. },
  180. hoverAnimation: false
  181. }]
  182. });
  183. res.series.push({
  184. name: '',
  185. type: 'pie',
  186. silent: true,
  187. z: 1,
  188. clockWise: false,
  189. hoverAnimation: false,
  190. radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
  191. center: ["50%", "65%"],
  192. label: {
  193. show: false
  194. },
  195. itemStyle: {
  196. label: {
  197. show: false,
  198. },
  199. labelLine: {
  200. show: false
  201. },
  202. borderWidth: 5,
  203. },
  204. data: [{
  205. value: 7.5,
  206. itemStyle: {
  207. color: "rgba(255,255,255,.1)",
  208. borderWidth: 0
  209. },
  210. tooltip: {
  211. show: false
  212. },
  213. hoverAnimation: false
  214. }, {
  215. value: 2.5,
  216. name: '',
  217. itemStyle: {
  218. color: "rgba(0,0,0,0)",
  219. borderWidth: 0
  220. },
  221. tooltip: {
  222. show: false
  223. },
  224. hoverAnimation: false
  225. }]
  226. });
  227. res.yAxis.push((data[i].value / sumValue * 100).toFixed(2) + "%")
  228. }
  229. return res
  230. }
  231. option = {
  232. legend: {
  233. orient: 'vertical',
  234. show: true,
  235. top: "20",
  236. left: 'center',
  237. data: arrName,
  238. itemWidth: 12,
  239. itemHeight: 12,
  240. //itemGap: 15,
  241. formatter: function(name) {
  242. return "{title|" + name + "}:{value|" + (objData[name].value) + "例}"
  243. },
  244. textStyle: {
  245. color: "rgba(255,255,255,.45)",
  246. rich: {
  247. title: {
  248. fontSize: 12,
  249. color: "rgba(255,255,255,.45)"
  250. },
  251. value: {
  252. fontSize: 12,
  253. color: "rgba(255,255,255,.85)"
  254. }
  255. }
  256. },
  257. },
  258. tooltip: {
  259. show: true,
  260. trigger: "item",
  261. formatter: "{a}<br>{b}:{c}({d}%)"
  262. },
  263. color: ['#FF8700', '#ffc300', '#00e473', '#009DFF'],
  264. grid: {
  265. top: '44%',
  266. bottom: '39%',
  267. left: "52%",
  268. containLabel: false
  269. },
  270. yAxis: [{
  271. type: 'category',
  272. inverse: true,
  273. axisLine: {
  274. show: false
  275. },
  276. axisTick: {
  277. show: false
  278. },
  279. axisLabel: {
  280. interval: 0,
  281. inside: true,
  282. textStyle: {
  283. color: "#fff",
  284. fontSize: 10,
  285. },
  286. show: true
  287. },
  288. data: optionData.yAxis
  289. }],
  290. xAxis: [{
  291. show: false
  292. }],
  293. series: optionData.series
  294. };
  295. myChart.setOption(option);
  296. window.addEventListener("resize",function(){
  297. myChart.resize();
  298. });
  299. }
  300. function echarts_3() {
  301. var myChart = echarts.init(document.getElementById('echart3'));
  302. data = [{
  303. name: "数据1",
  304. value: 13211
  305. }, {
  306. name: "数据2",
  307. value: 42111
  308. }, {
  309. name: "数据3",
  310. value: 81711
  311. }, {
  312. name: "数据4",
  313. value: 121711
  314. }
  315. ];
  316. arrName = getArrayValue(data, "name");
  317. arrValue = getArrayValue(data, "value");
  318. sumValue = eval(arrValue.join('+'));
  319. objData = array2obj(data, "name");
  320. optionData = getData(data);
  321. function getArrayValue(array, key) {
  322. var key = key || "value";
  323. var res = [];
  324. if (array) {
  325. array.forEach(function(t) {
  326. res.push(t[key])
  327. })
  328. }
  329. return res
  330. }
  331. function array2obj(array, key) {
  332. var resObj = {};
  333. for (var i = 0; i < array.length; i++) {
  334. resObj[array[i][key]] = array[i]
  335. }
  336. return resObj
  337. }
  338. function getData(data) {
  339. var res = {
  340. series: [],
  341. yAxis: []
  342. };
  343. for (let i = 0; i < data.length; i++) {
  344. res.series.push({
  345. name: '数据',
  346. type: 'pie',
  347. clockWise: false,
  348. hoverAnimation: false,
  349. radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
  350. center: ["50%", "65%"],
  351. label: {
  352. show: false
  353. },
  354. itemStyle: {
  355. label: {
  356. show: false,
  357. },
  358. labelLine: {
  359. show: false
  360. },
  361. borderWidth: 5,
  362. },
  363. data: [{
  364. value: data[i].value,
  365. name: data[i].name
  366. }, {
  367. value: sumValue - data[i].value,
  368. name: '',
  369. itemStyle: {
  370. color: "rgba(0,0,0,0)",
  371. borderWidth: 0
  372. },
  373. tooltip: {
  374. show: false
  375. },
  376. hoverAnimation: false
  377. }]
  378. });
  379. res.series.push({
  380. name: '',
  381. type: 'pie',
  382. silent: true,
  383. z: 1,
  384. clockWise: false,
  385. hoverAnimation: false,
  386. radius: [75 - i * 15 + '%', 65 - i * 15 + '%'],
  387. center: ["50%", "65%"],
  388. label: {
  389. show: false
  390. },
  391. itemStyle: {
  392. label: {
  393. show: false,
  394. },
  395. labelLine: {
  396. show: false
  397. },
  398. borderWidth: 5,
  399. },
  400. data: [{
  401. value: 7.5,
  402. itemStyle: {
  403. color: "rgba(255,255,255,.1)",
  404. borderWidth: 0
  405. },
  406. tooltip: {
  407. show: false
  408. },
  409. hoverAnimation: false
  410. }, {
  411. value: 2.5,
  412. name: '',
  413. itemStyle: {
  414. color: "rgba(0,0,0,0)",
  415. borderWidth: 0
  416. },
  417. tooltip: {
  418. show: false
  419. },
  420. hoverAnimation: false
  421. }]
  422. });
  423. res.yAxis.push((data[i].value / sumValue * 100).toFixed(2) + "%")
  424. }
  425. return res
  426. }
  427. option = {
  428. legend: {
  429. orient: 'vertical',
  430. show: true,
  431. top: "20",
  432. left: 'center',
  433. data: arrName,
  434. itemWidth: 12,
  435. itemHeight: 12,
  436. //itemGap: 15,
  437. formatter: function(name) {
  438. return "{title|" + name + "}:{value|" + (objData[name].value) + "例}"
  439. },
  440. textStyle: {
  441. color: "rgba(255,255,255,.45)",
  442. rich: {
  443. title: {
  444. fontSize: 12,
  445. color: "rgba(255,255,255,.45)"
  446. },
  447. value: {
  448. fontSize: 12,
  449. color: "rgba(255,255,255,.85)"
  450. }
  451. }
  452. },
  453. },
  454. tooltip: {
  455. show: true,
  456. trigger: "item",
  457. formatter: "{a}<br>{b}:{c}({d}%)"
  458. },
  459. color: ['#FF8700', '#ffc300', '#00e473', '#009DFF'],
  460. grid: {
  461. top: '44%',
  462. bottom: '39%',
  463. left: "52%",
  464. containLabel: false
  465. },
  466. yAxis: [{
  467. type: 'category',
  468. inverse: true,
  469. axisLine: {
  470. show: false
  471. },
  472. axisTick: {
  473. show: false
  474. },
  475. axisLabel: {
  476. interval: 0,
  477. inside: true,
  478. textStyle: {
  479. color: "#fff",
  480. fontSize: 10,
  481. },
  482. show: true
  483. },
  484. data: optionData.yAxis
  485. }],
  486. xAxis: [{
  487. show: false
  488. }],
  489. series: optionData.series
  490. };
  491. myChart.setOption(option);
  492. window.addEventListener("resize",function(){
  493. myChart.resize();
  494. });
  495. }
  496. function echarts_5() {
  497. // 基于准备好的dom,初始化echarts实例
  498. var myChart = echarts.init(document.getElementById('echart5'));
  499. option = {
  500. color: ['#1aa1ff', '#31c17b', '#ff6535'],
  501. tooltip: {
  502. trigger: 'axis',
  503. axisPointer: {
  504. type: 'shadow'
  505. }
  506. },
  507. grid: {
  508. left: '0%',
  509. top:'15px',
  510. right: '0%',
  511. bottom: '3%',
  512. containLabel: true
  513. },
  514. xAxis: {
  515. data: ['数据1', '数据2', '数据3', '数据4', '数据4', '数据5', '数据6', '数据7', '数据8', '数据9'],
  516. axisLine: {show:false,},
  517. axisLabel: {
  518. color: 'rgba(255,255,255,.6)',
  519. fontSize: 12
  520. }
  521. },
  522. yAxis: {
  523. name: "(人)",
  524. splitNumber:4,
  525. nameTextStyle: {
  526. color: 'rgba(255,255,255,.6)',
  527. fontSize: 12
  528. },
  529. axisLine: { show:false, },
  530. axisLabel: {
  531. color: 'rgba(255,255,255,.6)',
  532. fontSize: 12
  533. },
  534. splitLine: {
  535. lineStyle: {
  536. color: "rgba(255,255,255,.1)",
  537. type: "dotted"
  538. }
  539. },
  540. //interval:100,
  541. //max:500
  542. },
  543. series: [{
  544. type: 'bar',
  545. barWidth: '25%',
  546. itemStyle: {
  547. normal: {
  548. barBorderRadius: 50,
  549. color: function(params) {
  550. var colorList = ['#4591e3', '#04b8e5', '#04dde5', '#04e5bd', '#04e57e', '#fedb5b', '#e59e04','#ff632d','#ff639e','#ff82e9', '#b562e4'];
  551. return colorList[params.dataIndex]
  552. },
  553. label: {
  554. show: true,
  555. position: 'top',
  556. formatter: '{c}',
  557. color: 'rgba(255,255,255,.4)',
  558. fontSize: 12
  559. }
  560. }
  561. },
  562. data: [825, 605, 364, 345, 325, 261, 231, 215, 121, 91]
  563. }]
  564. };
  565. // 使用刚指定的配置项和数据显示图表。
  566. myChart.setOption(option);
  567. window.addEventListener("resize",function(){
  568. myChart.resize();
  569. });
  570. }
  571. function echarts_6() {
  572. // 基于准备好的dom,初始化echarts实例
  573. var myChart = echarts.init(document.getElementById('echart6'));
  574. option = {
  575. legend: {
  576. icon:"circle",
  577. top: "0",
  578. width:'100%',
  579. right: 'center',
  580. itemWidth: 10,
  581. itemHeight: 10,
  582. data: ['注册人数', '使用人数'],
  583. textStyle: {
  584. color: "rgba(255,255,255,.5)" },
  585. },
  586. tooltip: {
  587. trigger: 'axis',
  588. axisPointer: {
  589. lineStyle: {
  590. color: '#dddc6b'
  591. }
  592. }
  593. },
  594. grid: {
  595. left: '0',
  596. top: '30',
  597. right: '10',
  598. bottom: '-15',
  599. containLabel: true
  600. },
  601. xAxis: [{
  602. type: 'category',
  603. boundaryGap: false,
  604. axisLabel: {
  605. textStyle: {
  606. color: "rgba(255,255,255,.5)",
  607. // fontSize:10
  608. },
  609. },
  610. axisLine: {
  611. lineStyle: {
  612. color: 'rgba(255,255,255,.1)'
  613. }
  614. },
  615. data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
  616. }, {
  617. axisPointer: {show: false},
  618. axisLine: { show: false},
  619. position: 'bottom',
  620. offset: 20,
  621. }],
  622. yAxis: [{
  623. type: 'value',
  624. axisTick: {show: false},
  625. splitNumber: 4,
  626. axisLine: {
  627. lineStyle: {
  628. color: 'rgba(255,255,255,.1)'
  629. }
  630. },
  631. axisLabel: {
  632. textStyle: {
  633. color: "rgba(255,255,255,.5)",
  634. //fontSize:10
  635. },
  636. },
  637. splitLine: {
  638. lineStyle: {
  639. color: 'rgba(255,255,255,.1)',
  640. type: 'dotted',
  641. }
  642. }
  643. }],
  644. series: [
  645. {
  646. name: '注册人数',
  647. type: 'line',
  648. smooth: true,
  649. symbol: 'circle',
  650. symbolSize: 5,
  651. showSymbol: false,
  652. lineStyle: {
  653. normal: {
  654. color: 'rgba(31, 174, 234, 1)',
  655. width: 2
  656. }
  657. },
  658. areaStyle: {
  659. normal: {
  660. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  661. offset: 0,
  662. color: 'rgba(31, 174, 234, 0.4)'
  663. }, {
  664. offset: 0.8,
  665. color: 'rgba(31, 174, 234, 0.1)'
  666. }], false),
  667. shadowColor: 'rgba(0, 0, 0, 0.1)',
  668. }
  669. },
  670. itemStyle: {
  671. normal: {
  672. color: '#1f7eea',
  673. borderColor: 'rgba(31, 174, 234, .1)',
  674. borderWidth: 5
  675. }
  676. },
  677. data: [3, 6, 3, 6, 3, 9, 3]
  678. },
  679. {
  680. name: '使用人数',
  681. type: 'line',
  682. smooth: true,
  683. symbol: 'circle',
  684. symbolSize: 5,
  685. showSymbol: false,
  686. lineStyle: {
  687. normal: {
  688. color: '#6bdd9b',
  689. width: 2
  690. }
  691. },
  692. areaStyle: {
  693. normal: {
  694. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  695. offset: 0,
  696. color: 'rgba(107, 221, 155, 0.4)'
  697. }, {
  698. offset: 0.8,
  699. color: 'rgba(107, 221, 155, 0.1)'
  700. }], false),
  701. shadowColor: 'rgba(0, 0, 0, 0.1)',
  702. }
  703. },
  704. itemStyle: {
  705. normal: {
  706. color: '#6bdd9b',
  707. borderColor: 'rgba(107, 221, 155, .1)',
  708. borderWidth: 5
  709. }
  710. },
  711. data: [ 5, 3, 7, 1, 8, 3, 5]
  712. },
  713. ]
  714. };
  715. // 使用刚指定的配置项和数据显示图表。
  716. myChart.setOption(option);
  717. window.addEventListener("resize",function(){
  718. myChart.resize();
  719. });
  720. }
  721. function echarts_4() {
  722. // 基于准备好的dom,初始化echarts实例
  723. var myChart = echarts.init(document.getElementById('echart4'));
  724. option = {
  725. tooltip: {
  726. trigger: 'axis',
  727. axisPointer: {
  728. type: 'shadow'
  729. }
  730. },
  731. legend: {
  732. data: ['数据1', '数据2', '数据3'],
  733. top:'2%',
  734. textStyle: {
  735. color: "rgba(255,255,255,.5)",
  736. fontSize: '12',
  737. },
  738. itemWidth: 12,
  739. itemHeight: 12,
  740. //itemGap: 35
  741. },
  742. grid: {
  743. left: '0%',
  744. top:'40px',
  745. right: '0%',
  746. bottom: '0%',
  747. containLabel: true
  748. },
  749. xAxis: [{
  750. type: 'category',
  751. data: ['5.10', '5.11', '5.12', '5.13', '5.14', '5.15', '5.16', '5.17', '5.18'],
  752. axisLine: {
  753. show: true,
  754. lineStyle: {
  755. color: "rgba(255,255,255,.1)",
  756. width: 1,
  757. },
  758. },
  759. axisTick: {
  760. show: false,
  761. },
  762. axisLabel: {
  763. interval: 0,
  764. // rotate:50,
  765. show: true,
  766. splitNumber: 15,
  767. textStyle: {
  768. color: "rgba(255,255,255,.6)",
  769. fontSize: '12',
  770. },
  771. },
  772. }],
  773. yAxis: [{
  774. type: 'value',
  775. axisLabel: {
  776. //formatter: '{value} %'
  777. show:true,
  778. textStyle: {
  779. color: "rgba(255,255,255,.6)",
  780. fontSize: '12',
  781. },
  782. },
  783. axisTick: {
  784. show: false,
  785. },
  786. axisLine: {
  787. show: false,
  788. },
  789. splitLine: {
  790. lineStyle: {
  791. color: "rgba(255,255,255,.1)",
  792. type: "dotted"
  793. }
  794. }
  795. }],
  796. series: [{
  797. name: '数据1',
  798. type: 'bar',
  799. data: [2, 3, 3, 5, 15, 7, 6, 2, 6],
  800. barWidth:'15%', //柱子宽度
  801. // barGap: 1, //柱子之间间距
  802. itemStyle: {
  803. normal: {
  804. color:'#2f89cf',
  805. opacity: 1,
  806. barBorderRadius: 5,
  807. }
  808. }
  809. }, {
  810. name: '数据2',
  811. type: 'bar',
  812. data: [1, 4, 5, 3, 12, 3, 5, 3, 5],
  813. barWidth:'15%',
  814. // barGap: 1,
  815. itemStyle: {
  816. normal: {
  817. color:'#62c98d',
  818. opacity: 1,
  819. barBorderRadius: 5,
  820. }
  821. }
  822. },
  823. {
  824. name: '数据3',
  825. type: 'bar',
  826. data: [1, 3, 2, 4, 5, 2, 3, 1, 2],
  827. barWidth:'15%',
  828. // barGap: 1,
  829. itemStyle: {
  830. normal: {
  831. color:'#ffc107',
  832. opacity: 1,
  833. barBorderRadius: 5,
  834. }
  835. }
  836. },
  837. ]
  838. };
  839. // 使用刚指定的配置项和数据显示图表。
  840. myChart.setOption(option);
  841. window.addEventListener("resize",function(){
  842. myChart.resize();
  843. });
  844. }
  845. function echarts_7() {
  846. // 基于准备好的dom,初始化echarts实例
  847. var myChart = echarts.init(document.getElementById('echart7'));
  848. option = {
  849. tooltip: {
  850. trigger: 'axis',
  851. axisPointer: {type: 'shadow'},
  852. },
  853. grid: {
  854. left: '0',
  855. right: '0',
  856. bottom: '0',
  857. top: '10%',
  858. containLabel: true
  859. },
  860. xAxis: [{
  861. type: 'category',
  862. data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  863. axisLine: {
  864. show: true,
  865. lineStyle: {
  866. color: "#ffffff",
  867. width: 1,
  868. type: "solid",
  869. opacity: 0.3
  870. }
  871. },
  872. axisTick: {
  873. show: false
  874. },
  875. axisLine:{ show: false},
  876. axisLabel: {
  877. show: true,
  878. textStyle: {
  879. color: "rgba(255,255,255,.5)",
  880. }
  881. },
  882. }],
  883. yAxis: [{
  884. type: 'value',
  885. axisLabel: {
  886. formatter: '{value}'
  887. },
  888. axisLine: {
  889. show: false,
  890. },
  891. axisLabel: {
  892. show: true,
  893. textStyle: {
  894. color: "rgba(255,255,255,.5)",
  895. }
  896. },
  897. axisTick: {
  898. show: false
  899. },
  900. splitNumber:3,
  901. splitLine: {
  902. lineStyle: {
  903. color: "rgba(255,255,255,.05)",
  904. }
  905. }
  906. }],
  907. series: [{
  908. type: 'pictorialBar',
  909. symbol: 'path://M35,0L35,70L0,70z M35,0L35,70L70,70z',
  910. data: [20, 50, 80, 58, 183, 68, 57, 80, 142, 66, 42, 66],
  911. barWidth: '40%', //柱子宽度
  912. itemStyle: {
  913. normal: {
  914. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  915. offset: 0,
  916. color: '#173f9a'
  917. }, {
  918. offset: 0.5,
  919. color: '#173f9a'
  920. }, {
  921. offset: 0.5,
  922. color: '#247ed1'
  923. }
  924. , {
  925. offset: 1,
  926. color: '#247ed1'
  927. }]),
  928. opacity: 1,
  929. }
  930. }
  931. }]
  932. };
  933. // 使用刚指定的配置项和数据显示图表。
  934. myChart.setOption(option);
  935. window.addEventListener("resize",function(){
  936. myChart.resize();
  937. });
  938. }
  939. })