culturalTourism.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. function culturalTourism() {
  2. // 文化旅游
  3. $('.cumulat').removeClass('click');
  4. $('.thisMonth').addClass('click');
  5. var shbzTableHtml = `
  6. <ul class="title">
  7. <li style="width: 101px;">范围</li>
  8. <li><span>旅游总收入</span><span>(万元)</span></li>
  9. <li><span>旅游从业人数</span><span>(人)</span></li>
  10. </ul>
  11. <ul class="number">
  12. <li style="width: 100px;">当月</li>
  13. <li>322,450</li>
  14. <li>31,012</li>
  15. </ul>
  16. `
  17. $(".wsylTable").empty().html(shbzTableHtml)
  18. var chartDom = document.getElementById('whlyEchar');
  19. var myChart = echarts.init(chartDom);
  20. var alldata = [[4256415, 225424], [31762696, 1724264]];
  21. var option;
  22. var data = alldata[0]
  23. option = {
  24. grid: {
  25. // 网格线配置
  26. show: true,
  27. lineStyle: {
  28. color: ["#e9e9e9"],
  29. width: 1,
  30. type: "solid",
  31. },
  32. left: 100
  33. },
  34. tooltip: {
  35. trigger: 'axis',
  36. axisPointer: {
  37. type: 'shadow'
  38. },
  39. backgroundColor: "rgb(0 0 0 / 40%)",
  40. borderColor: 'none',
  41. formatter: function (params) {
  42. let total = params[0].value + params[1].value;
  43. var html = "";
  44. html = `<div
  45. style="font-size: 14px;font-family: Microsoft YaHei;color: #FFFFFF;width: 206px;border-radius: 10px;box-sizing: border-box;position: relative;">
  46. <div>`+ params[0].axisValue + `:</div>
  47. <div>`+ total.toLocaleString() + `人次<span style="margin-left:20px;"></span></div>
  48. <div style="width: 272px;height: 1px;background:rgb(255 255 255 / 32%);margin: 10px 0;"></div>
  49. <div><span
  50. style="width: 11px;height: 11px;background: `+ params[0].color + `;border-radius: 6px;display:inline-block;margin-right:5px;"></span><span>` + params[0].seriesName + `:
  51. `+ params[0].value.toLocaleString() + `人次</span>
  52. </div>
  53. <div><span
  54. style="width: 11px;height: 11px;background: `+ params[1].color + `;border-radius: 6px;display:inline-block;margin-right:5px;"></span><span>` + params[1].seriesName + `:
  55. `+ params[1].value.toLocaleString() + `人次</span><span style="margin-left:20px;"></span>
  56. </div>
  57. </div>`
  58. return html;
  59. },
  60. confine: true
  61. },
  62. xAxis: {
  63. type: 'category',
  64. data: ['接待海内外游客', '过夜游客'],
  65. axisLabel: {
  66. show: true,
  67. textStyle: {
  68. color: '#333', //更改坐标轴文字颜色
  69. fontSize: 14 //更改坐标轴文字大小
  70. }
  71. },
  72. isTick: {
  73. show: true //坐标轴刻度线
  74. },
  75. axisLine: { //轴线
  76. show: true
  77. },
  78. splitLine: { //网格线
  79. show: true
  80. },
  81. },
  82. yAxis: {
  83. type: 'value',
  84. min: 0,
  85. max: 5000000,
  86. interval: 1000000,
  87. axisLabel: {
  88. formatter: '{value}人次'
  89. },
  90. axisTick: {
  91. show: true //坐标轴刻度线
  92. },
  93. axisLine: { //轴线
  94. show: true
  95. },
  96. splitLine: { //网格线
  97. show: true
  98. }
  99. },
  100. series: [
  101. {
  102. name: '海外游客',
  103. barWidth: 100,
  104. data: [0, 0],
  105. type: 'bar',
  106. itemStyle: {
  107. color: '#A7D0FD'
  108. },
  109. },
  110. //4256415 225424 322450 31012
  111. //31762696 1724264 2370899 286838
  112. {
  113. name: '海内游客',
  114. barWidth: 100,
  115. data: data,
  116. type: 'bar',
  117. barGap: '-100%',//移动第二个柱子的位置实现重叠
  118. z: '-1',//改变这根柱子的层级使这根柱子在下面,
  119. itemStyle: {
  120. color: '#509EF3'
  121. }
  122. }
  123. ]
  124. };
  125. option && myChart.setOption(option);
  126. // 文化旅游
  127. $('.thisMonth').click(function () {
  128. $('.cumulat').removeClass('click');
  129. $('.thisMonth').addClass('click');
  130. var shbzTableHtml = `
  131. <ul class="title">
  132. <li style="width: 101px;">范围</li>
  133. <li><span>旅游总收入</span><span>(万元)</span></li>
  134. <li><span>旅游从业人数</span><span>(人)</span></li>
  135. </ul>
  136. <ul class="number">
  137. <li style="width: 100px;">当月</li>
  138. <li>322,450</li>
  139. <li>31,012</li>
  140. </ul>
  141. `
  142. $(".wsylTable").empty().html(shbzTableHtml)
  143. var option;
  144. var data = alldata[0]
  145. option = {
  146. grid: {
  147. // 网格线配置
  148. show: true,
  149. lineStyle: {
  150. color: ["#e9e9e9"],
  151. width: 1,
  152. type: "solid",
  153. },
  154. left: 100
  155. },
  156. tooltip: {
  157. trigger: 'axis',
  158. axisPointer: {
  159. type: 'shadow'
  160. },
  161. backgroundColor: "rgb(0 0 0 / 40%)",
  162. borderColor: 'none',
  163. formatter: function (params) {
  164. let total = params[0].value + params[1].value;
  165. var html = "";
  166. html = `<div
  167. style="font-size: 14px;font-family: Microsoft YaHei;color: #FFFFFF;width: 206px;border-radius: 10px;box-sizing: border-box;position: relative;">
  168. <div>`+ params[0].axisValue + `:</div>
  169. <div>`+ total.toLocaleString() + `人次<span style="margin-left:20px;"></span></div>
  170. <div style="width: 272px;height: 1px;background:rgb(255 255 255 / 32%);margin: 10px 0;"></div>
  171. <div><span
  172. style="width: 11px;height: 11px;background: `+ params[0].color + `;border-radius: 6px;display:inline-block;margin-right:5px;"></span><span>` + params[0].seriesName + `:
  173. `+ params[0].value.toLocaleString() + `人次</span>
  174. </div>
  175. <div><span
  176. style="width: 11px;height: 11px;background: `+ params[1].color + `;border-radius: 6px;display:inline-block;margin-right:5px;"></span><span>` + params[1].seriesName + `:
  177. `+ params[1].value.toLocaleString() + `人次</span><span style="margin-left:20px;"></span>
  178. </div>
  179. </div>`
  180. return html;
  181. },
  182. confine: true
  183. },
  184. xAxis: {
  185. type: 'category',
  186. data: ['接待海内外游客', '过夜游客'],
  187. axisLabel: {
  188. show: true,
  189. textStyle: {
  190. color: '#333', //更改坐标轴文字颜色
  191. fontSize: 14 //更改坐标轴文字大小
  192. }
  193. },
  194. isTick: {
  195. show: true //坐标轴刻度线
  196. },
  197. axisLine: { //轴线
  198. show: true
  199. },
  200. splitLine: { //网格线
  201. show: true
  202. },
  203. },
  204. yAxis: {
  205. type: 'value',
  206. min: 0,
  207. max: 5000000,
  208. interval: 1000000,
  209. axisLabel: {
  210. formatter: '{value}(人次)'
  211. },
  212. axisTick: {
  213. show: true //坐标轴刻度线
  214. },
  215. axisLine: { //轴线
  216. show: true
  217. },
  218. splitLine: { //网格线
  219. show: true
  220. }
  221. },
  222. series: [
  223. {
  224. name: '海外游客',
  225. barWidth: 100,
  226. data: [0, 0],
  227. type: 'bar',
  228. itemStyle: {
  229. color: '#A7D0FD'
  230. }
  231. },
  232. //4256415 225424 322450 31012
  233. //31762696 1724264 2370899 286838
  234. {
  235. name: '海内游客',
  236. barWidth: 100,
  237. data: data,
  238. type: 'bar',
  239. barGap: '-100%',//移动第二个柱子的位置实现重叠
  240. z: '-1',//改变这根柱子的层级使这根柱子在下面,
  241. itemStyle: {
  242. color: '#509EF3'
  243. }
  244. }
  245. ]
  246. };
  247. myChart.clear();
  248. option && myChart.setOption(option);
  249. })
  250. $('.cumulat').click(function () {
  251. $('.cumulat').addClass('click');
  252. $('.thisMonth').removeClass('click');
  253. var shbzTableHtml = `
  254. <ul class="title">
  255. <li style="width: 101px;">范围</li>
  256. <li><span>旅游总收入</span><span>(万元)</span></li>
  257. <li><span>旅游从业人数</span><span>(人)</span></li>
  258. </ul>
  259. <ul class="number">
  260. <li style="width: 100px;">累计</li>
  261. <li>2,370,899</li>
  262. <li>286,838</li>
  263. </ul>
  264. `
  265. $(".wsylTable").empty().html(shbzTableHtml)
  266. var option;
  267. var data = alldata[1]
  268. option = {
  269. grid: {
  270. // 网格线配置
  271. show: true,
  272. lineStyle: {
  273. color: ["#e9e9e9"],
  274. width: 1,
  275. type: "solid",
  276. },
  277. left: 110
  278. },
  279. tooltip: {
  280. trigger: 'axis',
  281. axisPointer: {
  282. type: 'shadow'
  283. },
  284. backgroundColor: "rgb(0 0 0 / 40%)",
  285. borderColor: 'none',
  286. formatter: function (params) {
  287. let total = params[0].value + params[1].value;
  288. var html = "";
  289. html = `<div
  290. style="font-size: 14px;font-family: Microsoft YaHei;color: #FFFFFF;width: 206px;border-radius: 10px;box-sizing: border-box;position: relative;">
  291. <div>`+ params[0].axisValue + `:</div>
  292. <div>`+ total.toLocaleString() + `人次<span style="margin-left:20px;"></span></div>
  293. <div style="width: 272px;height: 1px;background:rgb(255 255 255 / 32%);margin: 10px 0;"></div>
  294. <div><span
  295. style="width: 11px;height: 11px;background: `+ params[0].color + `;border-radius: 6px;display:inline-block;margin-right:5px;"></span><span>` + params[0].seriesName + `:
  296. `+ params[0].value.toLocaleString() + `人次</span>
  297. </div>
  298. <div><span
  299. style="width: 11px;height: 11px;background: `+ params[1].color + `;border-radius: 6px;display:inline-block;margin-right:5px;"></span><span>` + params[1].seriesName + `:
  300. `+ params[1].value.toLocaleString() + `人次</span><span style="margin-left:20px;"></span>
  301. </div>
  302. </div>`
  303. return html;
  304. },
  305. confine: true
  306. },
  307. xAxis: {
  308. type: 'category',
  309. data: ['接待海内外游客', '过夜游客'],
  310. axisLabel: {
  311. show: true,
  312. textStyle: {
  313. color: '#333', //更改坐标轴文字颜色
  314. fontSize: 14 //更改坐标轴文字大小
  315. }
  316. },
  317. isTick: {
  318. show: true //坐标轴刻度线
  319. },
  320. axisLine: { //轴线
  321. show: true
  322. },
  323. splitLine: { //网格线
  324. show: true
  325. },
  326. },
  327. yAxis: {
  328. type: 'value',
  329. min: 0,
  330. max: 35000000,
  331. interval: 10000000,
  332. axisLabel: {
  333. formatter: '{value}(人次)'
  334. },
  335. axisTick: {
  336. show: true //坐标轴刻度线
  337. },
  338. axisLine: { //轴线
  339. show: true
  340. },
  341. splitLine: { //网格线
  342. show: true
  343. }
  344. },
  345. series: [
  346. {
  347. name: '海外游客',
  348. barWidth: 100,
  349. data: [0, 0],
  350. type: 'bar',
  351. itemStyle: {
  352. color: '#A7D0FD'
  353. }
  354. },
  355. //4256415 225424 322450 31012
  356. //31762696 1724264 2370899 286838
  357. {
  358. name: '海内游客',
  359. barWidth: 100,
  360. data: data,
  361. type: 'bar',
  362. barGap: '-100%',//移动第二个柱子的位置实现重叠
  363. z: '-1',//改变这根柱子的层级使这根柱子在下面,
  364. itemStyle: {
  365. color: '#509EF3'
  366. }
  367. }
  368. ]
  369. };
  370. myChart.clear();
  371. option && myChart.setOption(option);
  372. })
  373. }