visualizedCharts.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. //定义图表对象
  2. var myChart1 = null;
  3. var myChart2 = null;
  4. var myChart3 = null;
  5. var myChart4 = null;
  6. var myChart5 = null;
  7. var myChart6 = null;
  8. var myChart7 = null;
  9. var myChart8 = null;
  10. $(function() {
  11. function load() {
  12. $.ajax({
  13. url: "c1.htm", async: false, dataType: 'json', success: function(result) {
  14. industryBar(result.array);
  15. }
  16. });
  17. $.ajax({
  18. url: "c2.htm", async: false, dataType: 'json', success: function(result) {
  19. changeChart(result.array);
  20. }
  21. });
  22. $.ajax({
  23. url: "c3.htm", async: false, dataType: 'json', success: function(result) {
  24. skillAcquisitionChart(result.array);
  25. }
  26. });
  27. // $.ajax({
  28. // url: "c4.htm", async: false, dataType: 'json', success: function(result) {
  29. // pieChart(result.array);
  30. // }
  31. // });
  32. var currentnum = 0; allnum = 0;
  33. $.ajax({
  34. url: "allnum.htm", async: false, dataType: 'json', success: function(result) {
  35. allnum = result.array[0].allnum;
  36. currentnum = result.array[0].currentnum;
  37. }
  38. });
  39. clocknum(currentnum, 'requiredPeoples');
  40. clocknum(allnum, 'supplyPeoples');
  41. }
  42. load();
  43. setInterval(function() {
  44. load();
  45. }, 10000);
  46. //roseChart();
  47. /* $(".digits").numScroll({
  48. time:5000
  49. });*/
  50. });
  51. /**
  52. * 柱形图
  53. */
  54. function industryBar(data) {
  55. let xAxisData = data.map(v => v.college);
  56. let yAxisData = data.map(v => v.currentnum);
  57. myChart1 = echarts.init(document.getElementById('industryBar')); // 基于准备好的dom,初始化echarts实例
  58. var option = {
  59. title: {
  60. text: '院系报到数据',
  61. left: 'center',
  62. textStyle: { color: '#fff' },
  63. top: '4%',
  64. },
  65. tooltip: {
  66. trigger: 'axis',
  67. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  68. type: 'line' // 默认为直线,可选为:'line' | 'shadow'
  69. }
  70. },
  71. grid: {
  72. left: '2%',
  73. right: '4%',
  74. top: '12%',
  75. bottom: '3%',
  76. containLabel: true
  77. },
  78. xAxis: [
  79. {
  80. type: 'category',
  81. data: xAxisData,
  82. axisTick: {
  83. alignWithLabel: false
  84. },
  85. axisLabel: { //x轴文字颜色
  86. color: '#fff',
  87. show: true,
  88. formatter: function(value, index) {
  89. return value.split('').join('\n');
  90. }
  91. },
  92. axisLine: { //x轴线的颜色
  93. lineStyle: {
  94. color: ['#fff'],
  95. width: 1,
  96. type: 'solid',
  97. opacity: 0.1
  98. }
  99. }
  100. }
  101. ],
  102. yAxis: [
  103. {
  104. type: 'value',
  105. axisLabel: { //y轴文字颜色
  106. color: '#fff'
  107. },
  108. axisLine: { //y轴线的颜色
  109. lineStyle: {
  110. color: ['#fff'],
  111. width: 1,
  112. type: 'solid',
  113. opacity: 1
  114. }
  115. },
  116. splitLine: { //网格样式
  117. show: true,
  118. lineStyle: {
  119. color: 'rgba(255,255,255,0.3)',
  120. width: 1,
  121. type: 'dashed'
  122. }
  123. }
  124. }
  125. ],
  126. series: [
  127. {
  128. // name: '直接访问',
  129. type: 'bar',
  130. barWidth: '50%',
  131. itemStyle: {
  132. normal: {
  133. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  134. offset: 0,
  135. color: '#248ff7'
  136. }, {
  137. offset: 1,
  138. color: '#6851f1'
  139. }]),
  140. barBorderRadius: 11,
  141. }
  142. },
  143. data: yAxisData
  144. }
  145. ]
  146. };
  147. myChart1.setOption(option, true); // 使用刚指定的配置项和数据显示图表。
  148. $(document).ready(function() {
  149. myChart1.resize();
  150. })
  151. window.addEventListener("resize", function() {
  152. myChart1.resize();
  153. });
  154. }
  155. var app = {
  156. currentIndex: -1,
  157. };
  158. setInterval(function() {
  159. var dataLen = 15;
  160. // 取消之前高亮的图形
  161. myChart1.dispatchAction({
  162. type: 'downplay',
  163. seriesIndex: 0,
  164. dataIndex: app.currentIndex
  165. });
  166. app.currentIndex = (app.currentIndex + 1) % dataLen;
  167. //console.log(app.currentIndex);
  168. // 高亮当前图形
  169. myChart1.dispatchAction({
  170. type: 'highlight',
  171. seriesIndex: 0,
  172. dataIndex: app.currentIndex,
  173. });
  174. // 显示 tooltip
  175. myChart1.dispatchAction({
  176. type: 'showTip',
  177. seriesIndex: 0,
  178. dataIndex: app.currentIndex
  179. });
  180. }, 1000);
  181. /**
  182. *折线图
  183. */
  184. function changeChart(data) {
  185. let x = data.map(v => v.name);
  186. let d1 = data.map(v => v.d1);
  187. let d2 = data.map(v => v.d2);
  188. myChart2 = echarts.init(document.getElementById('changeLine'));
  189. var option = {
  190. title: {
  191. text: '报到接种疫苗',
  192. left: 'center',
  193. show:false,
  194. textStyle: { color: '#fff' },
  195. top: '4%',
  196. },
  197. grid: {
  198. left: '2%',
  199. right: '4%',
  200. top: '8%',
  201. bottom: '3%',
  202. containLabel: true
  203. },
  204. legend: {
  205. data: ['已报到', '已接种'],
  206. textStyle: { color: '#fff' },
  207. right: '4%',
  208. top: '3%',
  209. bottom: '5%',
  210. },
  211. xAxis: {
  212. type: 'category',
  213. data: x,
  214. axisLabel: { //x轴文字颜色
  215. color: '#fff',
  216. interval: 0,
  217. // rotate:"45"
  218. },
  219. axisLine: { //x轴线的颜色
  220. lineStyle: {
  221. color: ['#fff'],
  222. width: 1,
  223. type: 'solid',
  224. opacity: 0.1
  225. }
  226. }
  227. },
  228. yAxis: {
  229. type: 'value',
  230. axisLabel: { //x轴文字颜色
  231. color: '#fff'
  232. },
  233. axisLine: { //x轴线的颜色
  234. lineStyle: {
  235. color: ['#fff'],
  236. width: 1,
  237. type: 'solid',
  238. opacity: 0.1
  239. }
  240. },
  241. splitLine: { //网格样式
  242. show: true,
  243. lineStyle: {
  244. color: 'rgba(255,255,255,0.1)',
  245. width: 1,
  246. type: 'dashed'
  247. }
  248. }
  249. },
  250. color: ['#01dee1', "#ed3f35"], //曲线颜色
  251. series: [{
  252. name: '已报到',
  253. type: 'bar',
  254. data: d1,
  255. label: {
  256. show: true
  257. },
  258. itemStyle: {
  259. normal: {
  260. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  261. offset: 0,
  262. color: '#0090FF'
  263. }, {
  264. offset: 1,
  265. color: '#0090FF'
  266. }]),
  267. barBorderRadius: 11,
  268. }
  269. }
  270. }, {
  271. name: '已接种',
  272. type: 'bar',
  273. data: d2,
  274. label: {
  275. show: true
  276. },
  277. itemStyle: {
  278. normal: {
  279. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  280. offset: 0,
  281. color: '#ff3300'
  282. }, {
  283. offset: 1,
  284. color: '#ff3333'
  285. }]),
  286. barBorderRadius: 11,
  287. }
  288. }
  289. }]
  290. };
  291. myChart2.setOption(option, true); // 使用刚指定的配置项和数据显示图表。
  292. $(document).ready(function() {
  293. myChart2.resize();
  294. })
  295. window.addEventListener("resize", function() {
  296. myChart2.resize();
  297. });
  298. }
  299. /**
  300. *饼形图
  301. */
  302. function ageTrendPie() {
  303. myChart3 = echarts.init(document.getElementById('agePie'));
  304. var option = {
  305. title: {
  306. text: '年龄分析',
  307. left: 'center',
  308. textStyle: { color: '#fff' },
  309. top: '4%',
  310. },
  311. tooltip: {
  312. trigger: 'item',
  313. formatter: '{a} <br/>{b}: {c} ({d}%)'
  314. },
  315. grid: {
  316. left: '3%',
  317. right: '4%',
  318. top: '35%',
  319. bottom: '3%'
  320. },
  321. legend: {
  322. orient: 'vertical',
  323. left: 10,
  324. data: ['16岁', '17岁', '18岁', '19岁', '20岁', '21岁以上'],
  325. textStyle: {
  326. color: '#fff'
  327. }
  328. },
  329. series: [
  330. {
  331. name: '年龄占比',
  332. type: 'pie',
  333. radius: ['50%', '70%'],
  334. avoidLabelOverlap: true,
  335. label: {
  336. show: false,
  337. position: 'center'
  338. },
  339. emphasis: {
  340. label: {
  341. show: true,
  342. fontSize: '30',
  343. fontWeight: 'bold'
  344. }
  345. },
  346. labelLine: {
  347. show: false
  348. },
  349. itemStyle: {
  350. normal: {
  351. label: {
  352. show: true,
  353. formatter: '{b} \n ({d}%)'
  354. }
  355. }
  356. },
  357. color: ['#10606b', '#0696ab', '#06a0ab', '#86c9f4', '#4da8ec', '#3a91d2', '#005fa6', '#315f97'],
  358. data: [
  359. { value: 999, name: '16岁' },
  360. { value: 2000, name: '17岁' },
  361. { value: 1548, name: '18岁' },
  362. { value: 1548, name: '19岁' },
  363. { value: 1548, name: '20岁' },
  364. { value: 1548, name: '21岁以上' }
  365. ]
  366. }
  367. ]
  368. };
  369. myChart3.setOption(option, true); // 使用刚指定的配置项和数据显示图表。
  370. $(document).ready(function() {
  371. myChart3.resize();
  372. })
  373. window.addEventListener("resize", function() {
  374. myChart3.resize();
  375. });
  376. }
  377. /**
  378. *柱形图
  379. */
  380. function skillAcquisitionChart(cost) {
  381. //var cost = [1679, 78, 60, 34, 70,80,90]//本期比上期(大于1按1处理)
  382. var totalCost = [1679, 1679, 1679, 1679, "1679", "1679", "1679"]//比例综合
  383. var visits = [1679, 1679, 1679, 1679, "1679", "1679", "1679"]//本期占总的百分比*100
  384. var grade = ['招生处', '医务室', '保卫处', '学工部', '组织部', '公寓', '院系办公室'];
  385. var myColor = ['#21BF57', '#56D0E3', '#1089E7', '#F8B448', '#F57474',];
  386. var data = {
  387. grade: grade,
  388. cost: cost,
  389. totalCost: totalCost,
  390. visits: visits
  391. };
  392. var option = {
  393. title: {
  394. top: '4%',
  395. left: 'center',
  396. text: '节点报到数据',
  397. textStyle: {
  398. align: 'center',
  399. color: '#fff'
  400. }
  401. },
  402. grid: {
  403. left: '50',
  404. right: '35',
  405. bottom: '20'
  406. },
  407. xAxis: {
  408. show: false,
  409. },
  410. yAxis: {
  411. type: 'category',
  412. inverse: true,//倒
  413. axisLabel: {
  414. margin: 20,
  415. show: true,
  416. color: '#4DCEF8',
  417. fontSize: 12,
  418. formatter: function(value, index) {
  419. return value.split('').join('\n');
  420. }
  421. },
  422. axisTick: {
  423. show: false,
  424. },
  425. axisLine: {
  426. show: false,
  427. },
  428. data: data.grade
  429. },
  430. series: [{//外层边框
  431. type: 'bar',
  432. barGap: '-65%',
  433. label: {
  434. normal: {
  435. show: true,
  436. position: 'right',
  437. color: '#fff',
  438. fontSize: 14,
  439. formatter:
  440. function(param) {
  441. return data.visits[param.dataIndex];
  442. },
  443. }
  444. },
  445. barWidth: '50%',
  446. itemStyle: {
  447. normal: {
  448. borderColor: '#4DCEF8',
  449. borderWidth: 2,
  450. barBorderRadius: 12,
  451. color: 'rgba(102, 102, 102,0)'
  452. },
  453. },
  454. z: 1,
  455. data: data.totalCost,
  456. // data: da
  457. }, {//柱形图占比
  458. type: 'bar',
  459. barGap: '-85%',
  460. barWidth: '35%',
  461. itemStyle: {
  462. normal: {
  463. barBorderRadius: 14,
  464. color: function(params) {
  465. var num = myColor.length;
  466. return myColor[params.dataIndex % num]
  467. },
  468. }
  469. },
  470. max: 1,
  471. label: {
  472. normal: {
  473. show: true,
  474. position: 'inside',
  475. formatter: '{c}'
  476. }
  477. },
  478. labelLine: {
  479. show: true,
  480. },
  481. z: 2,
  482. data: data.cost,
  483. }]
  484. }
  485. myChart4 = echarts.init(document.getElementById('skillAcquisitionBar'));
  486. myChart4.setOption(option, true);
  487. $(document).ready(function() {
  488. myChart4.resize();
  489. })
  490. window.addEventListener("resize", function() {
  491. myChart4.resize();
  492. });
  493. }
  494. /**
  495. *折线图
  496. */
  497. function playCounts(echartData) {
  498. let bgColor = "#fff";
  499. let color = [
  500. "#0090FF",
  501. "#36CE9E",
  502. "#FFC005",
  503. "#FF515A",
  504. "#8B5CFF",
  505. "#00CA69"
  506. ];
  507. let xAxisData = echartData.map(v => v.name);
  508. //  ["1", "2", "3", "4", "5", "6", "7", "8"]
  509. let yAxisData1 = echartData.map(v => v.value1);
  510. // [100, 138, 350, 173, 180, 150, 180, 230]
  511. let yAxisData2 = echartData.map(v => v.value2);
  512. // [233, 233, 200, 180, 199, 233, 210, 180]
  513. let yAxisData3 = [233, 233, 200, 180, 199, 233, 210, 180];
  514. const hexToRgba = (hex, opacity) => {
  515. let rgbaColor = "";
  516. let reg = /^#[\da-f]{6}$/i;
  517. if (reg.test(hex)) {
  518. rgbaColor = `rgba(${parseInt("0x" + hex.slice(1, 3))},${parseInt(
  519. "0x" + hex.slice(3, 5)
  520. )},${parseInt("0x" + hex.slice(5, 7))},${opacity})`;
  521. }
  522. return rgbaColor;
  523. }
  524. /////////////////////
  525. var option = {
  526. title: {
  527. top: '4%',
  528. left: 'center',
  529. text: '本硕博 ',
  530. textStyle: {
  531. align: 'center',
  532. color: '#fff'
  533. }
  534. },
  535. legend: {
  536. right: 10,
  537. top: 10,
  538. textStyle: {
  539. color: "#fff"
  540. }
  541. },
  542. tooltip: {
  543. trigger: "axis",
  544. formatter: function(params) {
  545. let html = '';
  546. params.forEach(v => {
  547. console.log(v)
  548. html += `<div style="color: #666;font-size: 14px;line-height: 24px">
  549. <span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${color[v.componentIndex]};"></span>
  550. ${v.seriesName}.${v.name}
  551. <span style="color:${color[v.componentIndex]};font-weight:700;font-size: 18px">${v.value}</span>
  552. `;
  553. })
  554. return html
  555. },
  556. extraCssText: 'border-radius: 0;box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);color: #333;',
  557. axisPointer: {
  558. type: 'shadow',
  559. shadowStyle: {
  560. color: '#ffffff',
  561. shadowColor: 'rgba(225,225,225,1)',
  562. shadowBlur: 5
  563. }
  564. }
  565. },
  566. grid: {
  567. top: 70,
  568. bottom: 10,
  569. containLabel: true
  570. },
  571. xAxis: [{
  572. type: "category",
  573. boundaryGap: false,
  574. axisLabel: {
  575. formatter: '{value}',
  576. textStyle: {
  577. color: "#fff",
  578. opacity: 1
  579. }
  580. },
  581. axisLine: {
  582. lineStyle: {
  583. color: "#D9D9D9"
  584. }
  585. },
  586. data: xAxisData
  587. }],
  588. yAxis: [{
  589. type: "value",
  590. //name: '单位:人 ',
  591. axisLabel: {
  592. textStyle: {
  593. color: "#fff"
  594. }
  595. },
  596. nameTextStyle: {
  597. color: "#fff",
  598. fontSize: 12,
  599. lineHeight: 40
  600. },
  601. splitLine: { //网格样式
  602. show: true,
  603. lineStyle: {
  604. color: 'rgba(255,255,255,0.1)',
  605. width: 1,
  606. type: 'dashed'
  607. }
  608. },
  609. axisLine: {
  610. show: false
  611. },
  612. axisTick: {
  613. show: false
  614. }
  615. }],
  616. series: [{
  617. name: "硕士",
  618. type: "line",
  619. smooth: true,
  620. // showSymbol: false,/
  621. symbolSize: 8,
  622. zlevel: 3,
  623. lineStyle: {
  624. normal: {
  625. color: color[0],
  626. shadowBlur: 3,
  627. shadowColor: hexToRgba(color[0], 0.5),
  628. shadowOffsetY: 8
  629. }
  630. },
  631. areaStyle: {
  632. normal: {
  633. color: new echarts.graphic.LinearGradient(
  634. 0,
  635. 0,
  636. 0,
  637. 1,
  638. [{
  639. offset: 0,
  640. color: hexToRgba(color[0], 0.3)
  641. },
  642. {
  643. offset: 1,
  644. color: hexToRgba(color[0], 0.1)
  645. }
  646. ],
  647. false
  648. ),
  649. shadowColor: hexToRgba(color[0], 0.1),
  650. shadowBlur: 10
  651. }
  652. },
  653. data: yAxisData1
  654. }, {
  655. name: "博士",
  656. type: "line",
  657. smooth: true,
  658. // showSymbol: false,
  659. symbolSize: 8,
  660. zlevel: 3,
  661. lineStyle: {
  662. normal: {
  663. color: color[1],
  664. shadowBlur: 3,
  665. shadowColor: hexToRgba(color[1], 0.5),
  666. shadowOffsetY: 8
  667. }
  668. },
  669. areaStyle: {
  670. normal: {
  671. color: new echarts.graphic.LinearGradient(
  672. 0,
  673. 0,
  674. 0,
  675. 1,
  676. [{
  677. offset: 0,
  678. color: hexToRgba(color[1], 0.3)
  679. },
  680. {
  681. offset: 1,
  682. color: hexToRgba(color[1], 0.1)
  683. }
  684. ],
  685. false
  686. ),
  687. shadowColor: hexToRgba(color[1], 0.1),
  688. shadowBlur: 10
  689. }
  690. },
  691. data: yAxisData2
  692. }, {
  693. name: "本科",
  694. type: "line",
  695. smooth: true,
  696. // showSymbol: false,
  697. symbolSize: 8,
  698. zlevel: 3,
  699. lineStyle: {
  700. normal: {
  701. color: color[1],
  702. shadowBlur: 3,
  703. shadowColor: hexToRgba(color[2], 0.5),
  704. shadowOffsetY: 8
  705. }
  706. },
  707. areaStyle: {
  708. normal: {
  709. color: new echarts.graphic.LinearGradient(
  710. 0,
  711. 0,
  712. 0,
  713. 1,
  714. [{
  715. offset: 0,
  716. color: hexToRgba(color[2], 0.3)
  717. },
  718. {
  719. offset: 1,
  720. color: hexToRgba(color[2], 0.1)
  721. }
  722. ],
  723. false
  724. ),
  725. shadowColor: hexToRgba(color[2], 0.1),
  726. shadowBlur: 10
  727. }
  728. },
  729. data: yAxisData3
  730. }
  731. ]
  732. };
  733. myChart5 = echarts.init(document.getElementById('playCounts'));
  734. myChart5.setOption(option, true);
  735. myChart5.on("click", function (params) {
  736. console.log(params.name);
  737. });
  738. $(document).ready(function() {
  739. myChart5.resize();
  740. })
  741. window.addEventListener("resize", function() {
  742. myChart5.resize();
  743. });
  744. }
  745. /**
  746. *饼图
  747. */
  748. function pieChart(data) {
  749. let legend = data.map(v => v.name);
  750. var option = {
  751. color: ['#6328af', '#0090FF', '#36CE9E', '#3a91d2', '#06a0ab', '#86c9f4'],
  752. title: {
  753. text: '本硕博',
  754. left: 'center',
  755. top: '4%',
  756. textStyle: {
  757. color: '#fff'
  758. }
  759. },
  760. tooltip: {
  761. trigger: 'item',
  762. formatter: '{a} <br/>{b} : {c} ({d}%)'
  763. },
  764. legend: {
  765. left: 'center',
  766. top: 'bottom',
  767. show: false,
  768. data: legend,
  769. textStyle: {
  770. color: '#fff'
  771. }
  772. },
  773. toolbox: {
  774. show: true
  775. },
  776. series: [
  777. {
  778. name: '半径模式',
  779. type: 'pie',
  780. radius: [50, 100],
  781. center: ['50%', '50%'],
  782. label: {
  783. show: true
  784. },
  785. emphasis: {
  786. label: {
  787. show: true
  788. }
  789. },
  790. data: data
  791. }
  792. ]
  793. };
  794. myChart7 = echarts.init(document.getElementById('playCounts'));
  795. myChart7.setOption(option);
  796. $(document).ready(function() {
  797. myChart7.resize();
  798. })
  799. window.addEventListener("resize", function() {
  800. myChart7.resize();
  801. });
  802. }
  803. /**
  804. * 玫瑰图-地区分布
  805. */
  806. function roseChart() {
  807. var option = {
  808. color: ['#1d9dff', '#006cff', '#60cda0', '#ed8884', '#8b78f6', '#3a91d2', '#06a0ab', '#86c9f4'],
  809. title: {
  810. text: '地区分布',
  811. left: 'center',
  812. top: '4%',
  813. textStyle: {
  814. color: '#fff'
  815. }
  816. },
  817. tooltip: {
  818. trigger: 'item',
  819. formatter: '{a} <br/>{b} : {c} ({d}%)'
  820. },
  821. legend: {
  822. left: 'center',
  823. top: 'bottom',
  824. data: ['北京', '天津', '上海', '深圳', '广州', '厦门', '珠海', '西安'],
  825. textStyle: {
  826. color: '#fff'
  827. }
  828. },
  829. toolbox: {
  830. show: true,
  831. feature: {
  832. mark: { show: true },
  833. dataView: { show: true, readOnly: false },
  834. magicType: {
  835. show: true,
  836. type: ['pie', 'funnel']
  837. },
  838. restore: { show: true },
  839. saveAsImage: { show: true }
  840. }
  841. },
  842. series: [
  843. {
  844. name: '半径模式',
  845. type: 'pie',
  846. radius: [15, 90],
  847. center: ['50%', '50%'],
  848. roseType: 'radius',
  849. label: {
  850. show: true
  851. },
  852. emphasis: {
  853. label: {
  854. show: true
  855. }
  856. },
  857. data: [
  858. { value: 10, name: '北京' },
  859. { value: 15, name: '天津' },
  860. { value: 15, name: '上海' },
  861. { value: 25, name: '深圳' },
  862. { value: 20, name: '广州' },
  863. { value: 35, name: '厦门' },
  864. { value: 30, name: '珠海' },
  865. { value: 40, name: '西安' }
  866. ]
  867. }
  868. ]
  869. };
  870. myChart6.setOption(option);
  871. $(document).ready(function() {
  872. myChart6.resize();
  873. })
  874. window.addEventListener("resize", function() {
  875. myChart6.resize();
  876. });
  877. }
  878. /**
  879. *LED液晶屏数字字符效果
  880. */
  881. function showLEDNumber(value, id) {
  882. var htmlArr = [];
  883. var len = value.length;
  884. for (var i = 0; i < len; i++) {
  885. var number = value.charAt(i);
  886. htmlArr.push('<div class="clock c' + number + '" >');
  887. htmlArr.push('<div class="v n1"><div class="u"></div><div class="d"></div></div>');
  888. htmlArr.push('<div class="v n2"><div class="u"></div><div class="d"></div></div>');
  889. htmlArr.push('<div class="h n3"><div class="l"></div><div class="r"></div></div>');
  890. htmlArr.push('<div class="v n4"><div class="u"></div><div class="d"></div></div>');
  891. htmlArr.push('<div class="v n5"><div class="u"></div><div class="d"></div></div>');
  892. htmlArr.push('<div class="h n6"><div class="l"></div><div class="r"></div></div>');
  893. htmlArr.push('<div class="h n7"><div class="l"></div><div class="r"></div></div>');
  894. htmlArr.push('</div>');
  895. }
  896. $("#" + id).html(htmlArr.join(""));
  897. }
  898. function clocknum(num, id) {
  899. $('#' + id).empty();
  900. var html = '';
  901. var strarr = num.toString().split('');
  902. var digit_to_name = 'zero one two three four five six seven eight nine'.split(' ');
  903. for (var i = 0; i < strarr.length; i++) {
  904. if (strarr[i] == '.') {
  905. html += '<div class="dot"></div>'
  906. } else {
  907. var clasname = digit_to_name[strarr[i]];
  908. html += '<div class="' + clasname + '">' +
  909. '<span class="d1"></span>' +
  910. '<span class="d2"></span>' +
  911. '<span class="d3"></span>' +
  912. '<span class="d4"></span>' +
  913. '<span class="d5"></span>' +
  914. '<span class="d6"></span>' +
  915. '<span class="d7"></span>' +
  916. '</div>';
  917. }
  918. }
  919. $('#' + id).append(html);
  920. }