chars.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. var dom = document.getElementById("firsttab1");
  2. var dom2 = document.getElementById("firsttab2");
  3. var dom3 = document.getElementById("firsttab3");
  4. var dom4 = document.getElementById("firsttab4");
  5. var dom5 = document.getElementById("firsttab5");
  6. var dom6 = document.getElementById("firsttab6");
  7. var dom7 = document.getElementById("firsttab7");
  8. var dom8 = document.getElementById("firsttab8");
  9. var dom9 = document.getElementById("charbar");
  10. var dom10 = document.getElementById("charbar2");
  11. var dom11 = document.getElementById("secondRighttextChar");
  12. var dom12 = document.getElementById("secondRighttextChar1");
  13. var dom13 = document.getElementById("secondChar");
  14. var dom14 = document.getElementById("contentChar1");
  15. var dom15 = document.getElementById("contentChar2");
  16. var myChart = echarts.init(dom,"wonderland");
  17. var myChart2= echarts.init(dom2,"wonderland");
  18. var myChart3 = echarts.init(dom3,"wonderland");
  19. var myChart4 = echarts.init(dom4,"wonderland");
  20. var myChart5 = echarts.init(dom5,"wonderland");
  21. var myChart6= echarts.init(dom6,"wonderland");
  22. var myChart7 = echarts.init(dom7,"wonderland");
  23. var myChart8 = echarts.init(dom8,"wonderland");
  24. var myChart9 = echarts.init(dom9,"wonderland");
  25. var myChart10 = echarts.init(dom10,"wonderland");
  26. var myChart11 = echarts.init(dom11,"wonderland");
  27. var myChart12 = echarts.init(dom12,"wonderland");
  28. var myChart13 = echarts.init(dom13,"wonderland");
  29. var myChart14 = echarts.init(dom14,"wonderland");
  30. var myChart15 = echarts.init(dom15,"wonderland");
  31. window.addEventListener("resize", () => {
  32. this.myChart.resize();
  33. this.myChart2.resize();
  34. this.myChart3.resize();
  35. this.myChart4.resize();
  36. this.myChart5.resize();
  37. this.myChart6.resize();
  38. this.myChart7.resize();
  39. this.myChart8.resize();
  40. this.myChart9.resize();
  41. this.myChart10.resize();
  42. this.myChart11.resize();
  43. this.myChart12.resize();
  44. this.myChart13.resize();
  45. this.myChart14.resize();
  46. this.myChart15.resize();
  47. });
  48. option = {
  49. tooltip: {
  50. trigger: 'item',
  51. formatter: "{a} <br/>{b}: {c} ({d}%)"
  52. },
  53. series: [
  54. {
  55. name:'访问来源',
  56. type:'pie',
  57. radius: ['40%', '80%'],
  58. avoidLabelOverlap: false,
  59. label: {
  60. normal: {
  61. show: false,
  62. position: 'center'
  63. },
  64. emphasis: {
  65. show: true,
  66. textStyle: {
  67. fontSize: '30',
  68. fontWeight: 'bold'
  69. }
  70. }
  71. },
  72. labelLine: {
  73. normal: {
  74. show: false
  75. }
  76. },
  77. data:[
  78. {value:2.5, name:'2.5',itemStyle:{
  79. color:"#0268e8"
  80. }}
  81. ]
  82. }
  83. ]
  84. };
  85. if (option && typeof option === "object") {
  86. myChart.setOption(option, true);
  87. }
  88. if (option && typeof option === "object") {
  89. myChart2.setOption(option, true);
  90. }
  91. if (option && typeof option === "object") {
  92. myChart3.setOption(option, true);
  93. }
  94. if (option && typeof option === "object") {
  95. myChart4.setOption(option, true);
  96. }
  97. if (option && typeof option === "object") {
  98. myChart5.setOption(option, true);
  99. }
  100. if (option && typeof option === "object") {
  101. myChart6.setOption(option, true);
  102. }
  103. if (option && typeof option === "object") {
  104. myChart7.setOption(option, true);
  105. }
  106. if (option && typeof option === "object") {
  107. myChart8.setOption(option, true);
  108. }
  109. option1 = {
  110. title : {
  111. x:'center'
  112. },
  113. tooltip : {
  114. trigger: 'item',
  115. formatter: "{a} <br/>{b} : {c} ({d}%)"
  116. },
  117. legend: {
  118. orient: 'vertical',
  119. left: 'right',
  120. data: ['发代开','发票发','纳税申','发票旧','发认证']
  121. },
  122. series : [
  123. {
  124. name: '业务办理',
  125. type: 'pie',
  126. radius : '35%',
  127. center: ['50%', '60%'],
  128. data:[
  129. {value:335, name:'发票代开'},
  130. {value:310, name:'发票发售'},
  131. {value:234, name:'纳税申报'},
  132. {value:135, name:'发票验旧'},
  133. {value:1548, name:'发票认证'}
  134. ],
  135. itemStyle: {
  136. emphasis: {
  137. shadowBlur: 10,
  138. shadowOffsetX: 0,
  139. shadowColor: 'rgba(0, 0, 0, 0.5)'
  140. },
  141. normal:{
  142. color:function(params) {
  143. //自定义颜色
  144. var colorList = [
  145. '#01b7ff', '#fd7c28', '#6fb440', '#ffc800', '#2d89dc',
  146. ];
  147. textStyle : {
  148. // fontWeight : 300 ,
  149. fontSize : 8 //文字的字体大小
  150. }
  151. return colorList[params.dataIndex]
  152. }
  153. }
  154. }
  155. }
  156. ]
  157. };
  158. if (option1 && typeof option1 === "object") {
  159. myChart9.setOption(option1, true);
  160. }
  161. if (option1 && typeof option1 === "object") {
  162. myChart10.setOption(option1, true);
  163. }
  164. option2 = {
  165. color: ['#3398DB'],
  166. tooltip : {
  167. trigger: 'axis',
  168. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  169. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  170. }
  171. },
  172. grid: {
  173. left: '3%',
  174. right: '4%',
  175. bottom: '3%',
  176. containLabel: true
  177. },
  178. xAxis : [
  179. {
  180. type : 'category',
  181. data : ['省级', '市级'],
  182. axisTick: {
  183. alignWithLabel: true
  184. },
  185. axisTick: {
  186. show: false
  187. },
  188. axisLine: {
  189. lineStyle: {
  190. type: 'solid',
  191. color: '#fff',//左边线的颜色
  192. width:'2'//坐标线的宽度
  193. }
  194. },
  195. axisLabel: {
  196. textStyle: {
  197. color: '#fff',//坐标值得具体的颜色
  198. }
  199. }
  200. }
  201. ],
  202. yAxis : [
  203. {
  204. type : 'value',
  205. axisTick: {
  206. show: false
  207. },
  208. splitLine:{
  209. show:false
  210. },
  211. axisLine: {
  212. lineStyle: {
  213. type: 'solid',
  214. color: '#fff',//左边线的颜色
  215. width:'2'//坐标线的宽度
  216. }
  217. },
  218. axisLabel: {
  219. textStyle: {
  220. color: '#fff',//坐标值得具体的颜色
  221. }
  222. }
  223. }
  224. ],
  225. series : [
  226. {
  227. name:'直接访问',
  228. type:'bar',
  229. barWidth: '60%',
  230. data:[32.62, 52.68],
  231. itemStyle:{
  232. normal:{
  233. color: function (params){
  234. var colorList = ['#05fef8','#fedc00'];
  235. return colorList[params.dataIndex];
  236. }
  237. }
  238. }
  239. }
  240. ]
  241. };
  242. if (option2 && typeof option2 === "object") {
  243. myChart11.setOption(option2, true);
  244. }
  245. option3 = {
  246. tooltip: {
  247. trigger: 'item',
  248. formatter: "{a} <br/>{b}: {c} ({d}%)"
  249. },
  250. legend: {
  251. orient: 'vertical',
  252. x: 'left',
  253. data:['直接问','件营销','联盟广告','视频广告','搜索引擎']
  254. },
  255. series: [
  256. {
  257. name:'省级市级',
  258. type:'pie',
  259. radius: ['30%', '70%'],
  260. avoidLabelOverlap: false,
  261. label: {
  262. normal: {
  263. show: false,
  264. position: 'center'
  265. },
  266. emphasis: {
  267. show: true,
  268. textStyle: {
  269. fontSize: '30',
  270. fontWeight: 'bold'
  271. }
  272. }
  273. },
  274. itemStyle:{
  275. normal:{
  276. color: function (params){
  277. var colorList = ['#05fef8','#fedc00'];
  278. return colorList[params.dataIndex];
  279. }
  280. }
  281. },
  282. labelLine: {
  283. normal: {
  284. show: false
  285. }
  286. },
  287. data:[
  288. {value:335, name:'省级以上'},
  289. {value:310, name:'市级以上'}
  290. ]
  291. }
  292. ]
  293. };
  294. if (option3 && typeof option3 === "object") {
  295. myChart12.setOption(option3, true);
  296. }
  297. // Generate data
  298. var category = [];
  299. var dottedBase = +new Date();
  300. var lineData = [];
  301. var barData = [];
  302. for (var i = 0; i < 20; i++) {
  303. var date = new Date(dottedBase += 3600 * 24 * 1000);
  304. category.push([
  305. date.getFullYear(),
  306. date.getMonth() + 1,
  307. date.getDate()
  308. ].join('-'));
  309. var b = Math.random() * 200;
  310. var d = Math.random() * 200;
  311. barData.push(b)
  312. lineData.push(d + b);
  313. }
  314. // option
  315. option4 = {
  316. backgroundColor: '#0f375f',
  317. tooltip: {
  318. trigger: 'axis',
  319. axisPointer: {
  320. type: 'shadow'
  321. }
  322. },
  323. legend: {
  324. data: ['line', 'bar'],
  325. textStyle: {
  326. color: '#ccc'
  327. }
  328. },
  329. xAxis: {
  330. data: category,
  331. axisLine: {
  332. lineStyle: {
  333. color: '#ccc'
  334. }
  335. }
  336. },
  337. yAxis: {
  338. splitLine: {show: false},
  339. axisLine: {
  340. lineStyle: {
  341. color: '#ccc'
  342. }
  343. }
  344. },
  345. series: [{
  346. name: 'line',
  347. type: 'line',
  348. smooth: true,
  349. showAllSymbol: true,
  350. symbol: 'emptyCircle',
  351. symbolSize: 5,
  352. data: lineData
  353. }, {
  354. name: 'bar',
  355. type: 'bar',
  356. barWidth: 5,
  357. itemStyle: {
  358. normal: {
  359. barBorderRadius: 5,
  360. color: new echarts.graphic.LinearGradient(
  361. 0, 0, 0, 1,
  362. [
  363. {offset: 0, color: '#fbb307'},
  364. {offset: 1, color: '#84f00e'}
  365. ]
  366. )
  367. }
  368. },
  369. data: barData
  370. }, {
  371. name: 'line',
  372. type: 'bar',
  373. barGap: '-100%',
  374. barWidth: 10,
  375. itemStyle: {
  376. normal: {
  377. color: new echarts.graphic.LinearGradient(
  378. 0, 0, 0, 1,
  379. [
  380. {offset: 0, color: 'rgba(20,200,212,0.5)'},
  381. {offset: 0.2, color: 'rgba(20,200,212,0.2)'},
  382. {offset: 1, color: 'rgba(20,200,212,0)'}
  383. ]
  384. )
  385. }
  386. },
  387. z: -12,
  388. data: lineData
  389. }, {
  390. name: 'dotted',
  391. type: 'pictorialBar',
  392. symbol: 'rect',
  393. itemStyle: {
  394. normal: {
  395. color: '#0f375f'
  396. }
  397. },
  398. symbolRepeat: true,
  399. symbolSize: [12, 4],
  400. symbolMargin: 1,
  401. z: -10,
  402. data: lineData
  403. }]
  404. };
  405. if (option4 && typeof option4 === "object") {
  406. myChart13.setOption(option4, true);
  407. }
  408. option5 = {
  409. xAxis: {
  410. type: 'category',
  411. axisTick: {
  412. alignWithLabel: true
  413. },
  414. axisTick: {
  415. show: false
  416. },
  417. data: ['7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00','14:00'],
  418. axisLine: {
  419. lineStyle: {
  420. type: 'solid',
  421. color: '#fff',//左边线的颜色
  422. width:'2'//坐标线的宽度
  423. }
  424. },
  425. axisLabel: {
  426. textStyle: {
  427. color: '#fff',//坐标值得具体的颜色
  428. }
  429. }
  430. },
  431. yAxis: {
  432. type: 'value',
  433. axisTick: {
  434. show: true
  435. },
  436. splitLine:{
  437. // show:false
  438. },
  439. axisLine: {
  440. lineStyle: {
  441. type: 'solid',
  442. color: '#fff',//左边线的颜色
  443. width:'2'//坐标线的宽度
  444. }
  445. },
  446. axisLabel: {
  447. textStyle: {
  448. color: '#fff',//坐标值得具体的颜色
  449. }
  450. }
  451. },
  452. series: [{
  453. data: [5, 8, 20, 22, 24, 22, 35,18,10,1],
  454. type: 'line',
  455. smooth:.2,
  456. color:'#04fefa'
  457. }]
  458. };
  459. if (option5 && typeof option5 === "object") {
  460. myChart14.setOption(option5, true);
  461. }
  462. if (option5 && typeof option5 === "object") {
  463. myChart15.setOption(option5, true);
  464. }