mapIndex.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125
  1. var mapChart = echarts.init(document.getElementById("map"));
  2. // 获取所有按月循环的数据
  3. var bestSelling = dataOne().bestSelling;
  4. var mapData = dataOne().mapD;
  5. var pressRanking = dataOne().pressRanking;
  6. var saleBL = dataOne().saleBL;
  7. var stockBL = dataOne().stockBL;
  8. var saleStockR = dataOne().saleStockR;
  9. var allMData = dataOne().allMData;
  10. // 获取各地区的经纬度
  11. var convertData = function(data) {
  12. var res = [];
  13. for (var i = 0; i < data.length; i++) {
  14. var geoCoord = geoCoordMap[data[i].name];
  15. if (geoCoord) {
  16. res.push({
  17. name: data[i].name,
  18. value: geoCoord.concat(data[i].value)
  19. });
  20. }
  21. }
  22. return res;
  23. };
  24. // 散点数据 和 对应经纬度
  25. var data = [
  26. { name: "唐山", value: 14 },
  27. { name: "驻马店", value: 2 },
  28. { name: "合肥", value: 2 },
  29. { name: "舟山", value: 4 },
  30. { name: "齐齐哈尔", value: 4 },
  31. { name: "武汉", value: 4 },
  32. { name: "贵阳", value: 1 },
  33. { name: "广州", value: 1 },
  34. ];
  35. var geoCoordMap = {
  36. 海门: [121.15, 31.89],
  37. 鄂尔多斯: [109.781327, 39.608266],
  38. 招远: [120.38, 37.35],
  39. 舟山: [122.207216, 29.985295],
  40. 齐齐哈尔: [123.97, 47.33],
  41. 盐城: [120.13, 33.38],
  42. 赤峰: [118.87, 42.28],
  43. 青岛: [120.33, 36.07],
  44. 乳山: [121.52, 36.89],
  45. 金昌: [102.188043, 38.520089],
  46. 泉州: [118.58, 24.93],
  47. 莱西: [120.53, 36.86],
  48. 日照: [119.46, 35.42],
  49. 胶南: [119.97, 35.88],
  50. 南通: [121.05, 32.08],
  51. 拉萨: [91.11, 29.97],
  52. 云浮: [112.02, 22.93],
  53. 梅州: [116.1, 24.55],
  54. 文登: [122.05, 37.2],
  55. 上海: [121.48, 31.22],
  56. 攀枝花: [101.718637, 26.582347],
  57. 威海: [122.1, 37.5],
  58. 承德: [117.93, 40.97],
  59. 厦门: [118.1, 24.46],
  60. 汕尾: [115.375279, 22.786211],
  61. 潮州: [116.63, 23.68],
  62. 丹东: [124.37, 40.13],
  63. 太仓: [121.1, 31.45],
  64. 曲靖: [103.79, 25.51],
  65. 烟台: [121.39, 37.52],
  66. 福州: [119.3, 26.08],
  67. 瓦房店: [121.979603, 39.627114],
  68. 即墨: [120.45, 36.38],
  69. 抚顺: [123.97, 41.97],
  70. 玉溪: [102.52, 24.35],
  71. 张家口: [114.87, 40.82],
  72. 阳泉: [113.57, 37.85],
  73. 莱州: [119.942327, 37.177017],
  74. 湖州: [120.1, 30.86],
  75. 汕头: [116.69, 23.39],
  76. 昆山: [120.95, 31.39],
  77. 宁波: [121.56, 29.86],
  78. 湛江: [110.359377, 21.270708],
  79. 揭阳: [116.35, 23.55],
  80. 荣成: [122.41, 37.16],
  81. 连云港: [119.16, 34.59],
  82. 葫芦岛: [120.836932, 40.711052],
  83. 常熟: [120.74, 31.64],
  84. 东莞: [113.75, 23.04],
  85. 河源: [114.68, 23.73],
  86. 淮安: [119.15, 33.5],
  87. 泰州: [119.9, 32.49],
  88. 南宁: [108.33, 22.84],
  89. 营口: [122.18, 40.65],
  90. 惠州: [114.4, 23.09],
  91. 江阴: [120.26, 31.91],
  92. 蓬莱: [120.75, 37.8],
  93. 韶关: [113.62, 24.84],
  94. 嘉峪关: [98.289152, 39.77313],
  95. 广州: [113.23, 23.16],
  96. 延安: [109.47, 36.6],
  97. 太原: [112.53, 37.87],
  98. 清远: [113.01, 23.7],
  99. 中山: [113.38, 22.52],
  100. 昆明: [102.73, 25.04],
  101. 寿光: [118.73, 36.86],
  102. 盘锦: [122.070714, 41.119997],
  103. 长治: [113.08, 36.18],
  104. 深圳: [114.07, 22.62],
  105. 珠海: [113.52, 22.3],
  106. 宿迁: [118.3, 33.96],
  107. 咸阳: [108.72, 34.36],
  108. 铜川: [109.11, 35.09],
  109. 平度: [119.97, 36.77],
  110. 佛山: [113.11, 23.05],
  111. 海口: [110.35, 20.02],
  112. 江门: [113.06, 22.61],
  113. 章丘: [117.53, 36.72],
  114. 肇庆: [112.44, 23.05],
  115. 大连: [121.62, 38.92],
  116. 临汾: [111.5, 36.08],
  117. 吴江: [120.63, 31.16],
  118. 石嘴山: [106.39, 39.04],
  119. 沈阳: [123.38, 41.8],
  120. 苏州: [120.62, 31.32],
  121. 茂名: [110.88, 21.68],
  122. 嘉兴: [120.76, 30.77],
  123. 长春: [125.35, 43.88],
  124. 胶州: [120.03336, 36.264622],
  125. 银川: [106.27, 38.47],
  126. 张家港: [120.555821, 31.875428],
  127. 三门峡: [111.19, 34.76],
  128. 锦州: [121.15, 41.13],
  129. 南昌: [115.89, 28.68],
  130. 柳州: [109.4, 24.33],
  131. 三亚: [109.511909, 18.252847],
  132. 自贡: [104.778442, 29.33903],
  133. 吉林: [126.57, 43.87],
  134. 阳江: [111.95, 21.85],
  135. 泸州: [105.39, 28.91],
  136. 西宁: [101.74, 36.56],
  137. 宜宾: [104.56, 29.77],
  138. 呼和浩特: [111.65, 40.82],
  139. 成都: [104.06, 30.67],
  140. 大同: [113.3, 40.12],
  141. 镇江: [119.44, 32.2],
  142. 桂林: [110.28, 25.29],
  143. 张家界: [110.479191, 29.117096],
  144. 宜兴: [119.82, 31.36],
  145. 北海: [109.12, 21.49],
  146. 西安: [108.95, 34.27],
  147. 金坛: [119.56, 31.74],
  148. 东营: [118.49, 37.46],
  149. 牡丹江: [129.58, 44.6],
  150. 遵义: [106.9, 27.7],
  151. 绍兴: [120.58, 30.01],
  152. 扬州: [119.42, 32.39],
  153. 常州: [119.95, 31.79],
  154. 潍坊: [119.1, 36.62],
  155. 重庆: [106.54, 29.59],
  156. 台州: [121.420757, 28.656386],
  157. 南京: [118.78, 32.04],
  158. 滨州: [118.03, 37.36],
  159. 贵阳: [106.71, 26.57],
  160. 无锡: [120.29, 31.59],
  161. 本溪: [123.73, 41.3],
  162. 克拉玛依: [84.77, 45.59],
  163. 渭南: [109.5, 34.52],
  164. 马鞍山: [118.48, 31.56],
  165. 宝鸡: [107.15, 34.38],
  166. 焦作: [113.21, 35.24],
  167. 句容: [119.16, 31.95],
  168. 北京: [116.46, 39.92],
  169. 徐州: [117.2, 34.26],
  170. 衡水: [115.72, 37.72],
  171. 包头: [110, 40.58],
  172. 绵阳: [104.73, 31.48],
  173. 乌鲁木齐: [87.68, 43.77],
  174. 枣庄: [117.57, 34.86],
  175. 杭州: [120.19, 30.26],
  176. 淄博: [118.05, 36.78],
  177. 鞍山: [122.85, 41.12],
  178. 溧阳: [119.48, 31.43],
  179. 库尔勒: [86.06, 41.68],
  180. 安阳: [114.35, 36.1],
  181. 开封: [114.35, 34.79],
  182. 济南: [117, 36.65],
  183. 德阳: [104.37, 31.13],
  184. 温州: [120.65, 28.01],
  185. 九江: [115.97, 29.71],
  186. 邯郸: [114.47, 36.6],
  187. 临安: [119.72, 30.23],
  188. 兰州: [103.73, 36.03],
  189. 沧州: [116.83, 38.33],
  190. 临沂: [118.35, 35.05],
  191. 南充: [106.110698, 30.837793],
  192. 天津: [117.2, 39.13],
  193. 富阳: [119.95, 30.07],
  194. 泰安: [117.13, 36.18],
  195. 诸暨: [120.23, 29.71],
  196. 郑州: [113.65, 34.76],
  197. 哈尔滨: [126.63, 45.75],
  198. 聊城: [115.97, 36.45],
  199. 芜湖: [118.38, 31.33],
  200. 唐山: [118.02, 39.63],
  201. 平顶山: [113.29, 33.75],
  202. 邢台: [114.48, 37.05],
  203. 德州: [116.29, 37.45],
  204. 济宁: [116.59, 35.38],
  205. 荆州: [112.239741, 30.335165],
  206. 宜昌: [111.3, 30.7],
  207. 义乌: [120.06, 29.32],
  208. 丽水: [119.92, 28.45],
  209. 洛阳: [112.44, 34.7],
  210. 秦皇岛: [119.57, 39.95],
  211. 株洲: [113.16, 27.83],
  212. 石家庄: [114.48, 38.03],
  213. 莱芜: [117.67, 36.19],
  214. 常德: [111.69, 29.05],
  215. 保定: [115.48, 38.85],
  216. 湘潭: [112.91, 27.87],
  217. 金华: [119.64, 29.12],
  218. 岳阳: [113.09, 29.37],
  219. 长沙: [113, 28.21],
  220. 衢州: [118.88, 28.97],
  221. 廊坊: [116.7, 39.53],
  222. 菏泽: [115.480656, 35.23375],
  223. 合肥: [117.27, 31.86],
  224. 武汉: [114.31, 30.52],
  225. 大庆: [125.03, 46.58]
  226. };
  227. var Month = [
  228. "Jan",
  229. "Feb",
  230. "Mar",
  231. "Apr",
  232. "May",
  233. "Jun",
  234. "Jul",
  235. "Aug",
  236. "Sep",
  237. "Oct",
  238. "Nov",
  239. "Dec"
  240. ];
  241. // 省份数据
  242. var itemStyleD = [
  243. {
  244. name: '湖南',
  245. itemStyle: {
  246. normal: {
  247. areaColor: '#0554E4'
  248. },
  249. emphasis: {
  250. areaColor: "#0554E4"
  251. }
  252. }
  253. },
  254. {
  255. name: '上海',
  256. itemStyle: {
  257. normal: {
  258. areaColor: '#27E9FD'
  259. },
  260. emphasis: {
  261. areaColor: "#27E9FD"
  262. }
  263. }
  264. },
  265. {
  266. name: '云南',
  267. itemStyle: {
  268. normal: {
  269. areaColor: '#20CAF8'
  270. },
  271. emphasis: {
  272. areaColor: "#20CAF8"
  273. }
  274. }
  275. },
  276. {
  277. name: '湖北',
  278. itemStyle: {
  279. normal: {
  280. areaColor: '#005ce5'
  281. },
  282. emphasis: {
  283. areaColor: "#005ce5"
  284. }
  285. }
  286. },
  287. {
  288. name: '江苏',
  289. itemStyle: {
  290. normal: {
  291. areaColor: '#00b6f6'
  292. },
  293. emphasis: {
  294. areaColor: "#00b6f6"
  295. }
  296. }
  297. },
  298. {
  299. name: '江西',
  300. itemStyle: {
  301. normal: {
  302. areaColor: '#01a4f1'
  303. },
  304. emphasis: {
  305. areaColor: "#01a4f1"
  306. }
  307. }
  308. },
  309. {
  310. name: '内蒙古',
  311. itemStyle: {
  312. normal: {
  313. areaColor: '#00ccf7'
  314. },
  315. emphasis: {
  316. areaColor: "#00ccf7"
  317. }
  318. }
  319. },
  320. {
  321. name: '四川',
  322. itemStyle: {
  323. normal: {
  324. areaColor: '#0069e8'
  325. },
  326. emphasis: {
  327. areaColor: "#0069e8"
  328. }
  329. }
  330. },
  331. {
  332. name: '浙江',
  333. itemStyle: {
  334. normal: {
  335. areaColor: '#00b6f6'
  336. },
  337. emphasis: {
  338. areaColor: "#00b6f6"
  339. }
  340. }
  341. }
  342. ]
  343. var noneData = [
  344. {
  345. name: '广东',
  346. uploadcnt: 25.1,
  347. uploadpzs: 1.3,
  348. xsmy: 902,
  349. kcmy: 343,
  350. itemStyle: {
  351. normal: {
  352. areaColor: '#00d9fc'
  353. },
  354. emphasis: {
  355. areaColor: "#00d9fc"
  356. }
  357. }
  358. },
  359. {
  360. name: '甘肃',
  361. uploadcnt: 12.7,
  362. uploadpzs: 1.4,
  363. xsmy: 834,
  364. kcmy: 379,
  365. itemStyle: {
  366. normal: {
  367. areaColor: '#0042df'
  368. },
  369. emphasis: {
  370. areaColor: "#0042df"
  371. }
  372. }
  373. },
  374. {
  375. name: '河北',
  376. uploadcnt: 52.7,
  377. uploadpzs: 2.3,
  378. xsmy: 1034,
  379. kcmy: 460,
  380. itemStyle: {
  381. normal: {
  382. areaColor: '#034DE4'
  383. },
  384. emphasis: {
  385. areaColor: "#034DE4"
  386. }
  387. }
  388. },
  389. {
  390. name: '河南',
  391. uploadcnt: 52.7,
  392. uploadpzs: 1.1,
  393. xsmy: 824,
  394. kcmy: 402,
  395. itemStyle: {
  396. normal: {
  397. areaColor: '#034DE4'
  398. },
  399. emphasis: {
  400. areaColor: "#034DE4"
  401. }
  402. }
  403. },
  404. {
  405. name: '黑龙江',
  406. uploadcnt: 32.7,
  407. uploadpzs: 1.4,
  408. xsmy: 1240,
  409. kcmy: 645,
  410. itemStyle: {
  411. normal: {
  412. areaColor: '#17A3F1'
  413. },
  414. emphasis: {
  415. areaColor: "#17A3F1"
  416. }
  417. }
  418. },
  419. {
  420. name: '山东',
  421. uploadcnt: 42.7,
  422. uploadpzs: 1.3,
  423. xsmy: 1732,
  424. kcmy: 734,
  425. itemStyle: {
  426. normal: {
  427. areaColor: '#4BFFFF'
  428. },
  429. emphasis: {
  430. areaColor: "#4BFFFF"
  431. }
  432. }
  433. },
  434. {
  435. name: '新疆',
  436. uploadcnt: 32.1,
  437. uploadpzs: 1.4,
  438. xsmy: 1324,
  439. kcmy: 509,
  440. itemStyle: {
  441. normal: {
  442. areaColor: '#17A3F1'
  443. },
  444. emphasis: {
  445. areaColor: "#17A3F1"
  446. }
  447. }
  448. },
  449. {
  450. name: '宁夏',
  451. itemStyle: {
  452. normal: {
  453. areaColor: '#01b0f3'
  454. },
  455. emphasis: {
  456. areaColor: "#01b0f3",
  457. opacity: 0.2
  458. }
  459. },
  460. label: {
  461. show: false
  462. }
  463. },
  464. {
  465. name: '海南',
  466. itemStyle: {
  467. normal: {
  468. areaColor: '#00f0ff'
  469. },
  470. emphasis: {
  471. areaColor: "#00f0ff",
  472. opacity: 0.2
  473. }
  474. },
  475. label: {
  476. show: false
  477. }
  478. },
  479. {
  480. name: '台湾',
  481. itemStyle: {
  482. normal: {
  483. areaColor: '#0067e7'
  484. },
  485. emphasis: {
  486. areaColor: "#0067e7",
  487. opacity: 0.2
  488. }
  489. },
  490. label: {
  491. show: false
  492. }
  493. },
  494. {
  495. name: '香港',
  496. itemStyle: {
  497. normal: {
  498. areaColor: '#00dafa'
  499. },
  500. emphasis: {
  501. areaColor: "#00dafa",
  502. opacity: 0.2
  503. }
  504. },
  505. label: {
  506. show: false
  507. }
  508. },
  509. {
  510. name: '澳门',
  511. itemStyle: {
  512. normal: {
  513. areaColor: '#00dafa'
  514. },
  515. emphasis: {
  516. areaColor: "#00dafa",
  517. opacity: 0.2
  518. }
  519. },
  520. label: {
  521. show: false
  522. }
  523. },
  524. {
  525. name: '北京',
  526. itemStyle: {
  527. normal: {
  528. areaColor: '#034DE4'
  529. },
  530. emphasis: {
  531. areaColor: "#034DE4",
  532. opacity: 0.2
  533. }
  534. },
  535. label: {
  536. show: false
  537. }
  538. },
  539. {
  540. name: '天津',
  541. itemStyle: {
  542. normal: {
  543. areaColor: '#034DE4'
  544. },
  545. emphasis: {
  546. areaColor: "#034DE4",
  547. opacity: 0.2
  548. }
  549. },
  550. label: {
  551. show: false
  552. }
  553. },
  554. {
  555. name: '重庆',
  556. itemStyle: {
  557. normal: {
  558. areaColor: '#0E7DEB'
  559. },
  560. emphasis: {
  561. areaColor: "#0E7DEB",
  562. opacity: 0.2
  563. }
  564. },
  565. label: {
  566. show: false
  567. }
  568. },
  569. {
  570. name: '辽宁',
  571. itemStyle: {
  572. normal: {
  573. areaColor: '#034DE4'
  574. },
  575. emphasis: {
  576. areaColor: "#034DE4",
  577. opacity: 0.2
  578. }
  579. },
  580. label: {
  581. show: false
  582. }
  583. },
  584. {
  585. name: '安徽',
  586. itemStyle: {
  587. normal: {
  588. areaColor: '#27E8FD'
  589. },
  590. emphasis: {
  591. areaColor: "#27E8FD",
  592. opacity: 0.2
  593. }
  594. },
  595. label: {
  596. show: false
  597. }
  598. },
  599. {
  600. name: '广西',
  601. itemStyle: {
  602. normal: {
  603. areaColor: '#0088ec'
  604. },
  605. emphasis: {
  606. areaColor: "#0088ec",
  607. opacity: 0.2
  608. }
  609. },
  610. label: {
  611. show: false
  612. }
  613. },
  614. {
  615. name: '山西',
  616. itemStyle: {
  617. normal: {
  618. areaColor: '#01d0fa'
  619. },
  620. emphasis: {
  621. areaColor: "#01d0fa",
  622. opacity: 0.2
  623. }
  624. },
  625. label: {
  626. show: false
  627. }
  628. },
  629. {
  630. name: '陕西',
  631. itemStyle: {
  632. normal: {
  633. areaColor: '#01b0f3'
  634. },
  635. emphasis: {
  636. areaColor: "#01b0f3",
  637. opacity: 0.2
  638. }
  639. },
  640. label: {
  641. show: false
  642. }
  643. },
  644. {
  645. name: '吉林',
  646. itemStyle: {
  647. normal: {
  648. areaColor: '#0051e1'
  649. },
  650. emphasis: {
  651. areaColor: "#0051e1",
  652. opacity: 0.2
  653. }
  654. },
  655. label: {
  656. show: false
  657. }
  658. },
  659. {
  660. name: '福建',
  661. itemStyle: {
  662. normal: {
  663. areaColor: '#0158e3'
  664. },
  665. emphasis: {
  666. areaColor: "#0158e3",
  667. opacity: 0.2
  668. }
  669. },
  670. label: {
  671. show: false
  672. }
  673. },
  674. {
  675. name: '贵州',
  676. itemStyle: {
  677. normal: {
  678. areaColor: '#0199ef'
  679. },
  680. emphasis: {
  681. areaColor: "#0199ef",
  682. opacity: 0.2
  683. }
  684. },
  685. label: {
  686. show: false
  687. }
  688. },
  689. {
  690. name: '青海',
  691. itemStyle: {
  692. normal: {
  693. areaColor: '#005ae4'
  694. },
  695. emphasis: {
  696. areaColor: "#005ae4",
  697. opacity: 0.2
  698. }
  699. },
  700. label: {
  701. show: false
  702. }
  703. },
  704. {
  705. name: '西藏',
  706. itemStyle: {
  707. normal: {
  708. areaColor: '#01e9fd'
  709. },
  710. emphasis: {
  711. areaColor: "#01e9fd",
  712. opacity: 0.2
  713. }
  714. },
  715. label: {
  716. show: false
  717. }
  718. }
  719. ]
  720. for(key in mapData){
  721. for(var i = 0; i < mapData[key].length; i++){
  722. if(
  723. mapData[key][i]["uploadcnt"].trim() == "" &&
  724. mapData[key][i]["uploadpzs"].trim() == "" &&
  725. mapData[key][i]["xsmy"].trim() == "" &&
  726. mapData[key][i]["kcmy"].trim() == ""
  727. ){
  728. mapData[key][i].label = {show: false}
  729. }
  730. for(var j = 0; j < itemStyleD.length; j++){
  731. if(mapData[key][i]["name"] == itemStyleD[j]["name"]){
  732. mapData[key][i].itemStyle = itemStyleD[j]["itemStyle"];
  733. }
  734. }
  735. }
  736. mapData[key] = mapData[key].concat(noneData)
  737. }
  738. function formatterShow (params){
  739. var data = params.data;
  740. // console.log(data.uploadcnt)
  741. var numArr = [];
  742. var numData = [];
  743. var formatterStr = '';
  744. /* var paramsData = [
  745. // '{a|' + params.name + '}' + '\n',
  746. "上传条数:" + data.uploadcnt + '条',
  747. "品种数量:" + data.uploadpzs + '种',
  748. "销售码洋:" + data.xsmy + '万元',
  749. "库存码洋:" + data.kcmy + '万元'
  750. ] */
  751. if(data.uploadcnt != undefined && data.uploadcnt != ''){
  752. numArr.push(0)
  753. }
  754. if(data.uploadpzs != undefined && data.uploadpzs != ''){
  755. numArr.push(1)
  756. }
  757. if(data.xsmy != undefined && data.xsmy != ''){
  758. numArr.push(2)
  759. }
  760. if(data.kcmy != undefined && data.kcmy != ''){
  761. numArr.push(3)
  762. }
  763. for(var i = 0; i < numArr.length; i++){
  764. numData.push(paramsData[numArr[i]])
  765. }
  766. // console.log(numData.join(""))
  767. if(numData.length == 1){
  768. formatterStr = '{a|' + params.name + '}' + '\n' +
  769. '{b|' + numData[0] + '}'
  770. }else if(numData.length == 2){
  771. formatterStr = '{a|' + params.name + '}' + '\n' +
  772. '{b|' + numData[0] + '}' + '\n' +
  773. '{c|' + numData[1] + '}'
  774. }else if(numData.length == 3){
  775. formatterStr = '{a|' + params.name + '}' + '\n' +
  776. '{b|' + numData[0] + '}' + '\n' +
  777. '{c|' + numData[1] + '}' + '\n' +
  778. '{d|' + numData[2] + '}' + '\n'
  779. }else if(numData.length == 4){
  780. formatterStr = '{a|' + params.name + '}' + '\n' +
  781. '{b|' + numData[0] + '}' + '\n' +
  782. '{c|' + numData[1] + '}' + '\n' +
  783. '{d|' + numData[2] + '}' + '\n' +
  784. '{e|' + numData[3] + '}' + '\n'
  785. }
  786. return formatterStr
  787. }
  788. // 有数据省份
  789. var hasData = [8,9,8,8,8,6,7,7,8,8,8,7];
  790. // 全国12个月数据
  791. var point = 'image://img/point.png';
  792. var curIndx = 0;
  793. var rich = {
  794. a: {
  795. color: '#fff',
  796. fontSize: 18,
  797. align: 'left',
  798. padding: [0,0,64,44]
  799. },
  800. b: {
  801. color: '#fff',
  802. fontSize: 14,
  803. padding: [0,0,-60,110],
  804. align: 'left'
  805. },
  806. c: {
  807. color: '#fff',
  808. fontSize: 14,
  809. padding: [0,0,-25,110],
  810. align: 'left'
  811. },
  812. d: {
  813. color: '#fff',
  814. fontSize: 14,
  815. padding: [0,0,-2,110],
  816. align: 'left'
  817. },
  818. e: {
  819. color: '#fff',
  820. fontSize: 14,
  821. padding: [3,0,3,110],
  822. align: 'left'
  823. }
  824. }
  825. var option = {
  826. geo: {
  827. map: "china",
  828. label: {
  829. emphasis: {
  830. show: false
  831. }
  832. },
  833. roam: false,
  834. layoutCenter: ["50%", "55%"],
  835. layoutSize: "110%",
  836. regions: [
  837. {
  838. name: '南海诸岛',
  839. itemStyle: {
  840. areaColor: '#6F798D',
  841. opacity: 0.5
  842. }
  843. },
  844. {
  845. name: '北京',
  846. itemStyle: {
  847. areaColor: '#034DE4',
  848. opacity: 0.2
  849. }
  850. },
  851. {
  852. name: '天津',
  853. itemStyle: {
  854. areaColor: '#034DE4',
  855. opacity: 0.2
  856. }
  857. },
  858. {
  859. name: '上海',
  860. itemStyle: {
  861. areaColor: '#27E9FD',
  862. opacity: 0.2
  863. }
  864. },
  865. {
  866. name: '重庆',
  867. itemStyle: {
  868. areaColor: '#0E7DEB',
  869. opacity: 0.2
  870. }
  871. },
  872. {
  873. name: '河北',
  874. itemStyle: {
  875. areaColor: '#034DE4',
  876. opacity: 0.2
  877. }
  878. },
  879. {
  880. name: '河南',
  881. itemStyle: {
  882. areaColor: '#034DE4',
  883. opacity: 0.2
  884. }
  885. },
  886. {
  887. name: '云南',
  888. itemStyle: {
  889. areaColor: '#20CAF8',
  890. opacity: 0.2
  891. }
  892. },
  893. {
  894. name: '辽宁',
  895. itemStyle: {
  896. areaColor: '#034DE4',
  897. opacity: 0.2
  898. }
  899. },
  900. {
  901. name: '黑龙江',
  902. itemStyle: {
  903. areaColor: '#17A3F1',
  904. opacity: 0.2
  905. }
  906. },
  907. {
  908. name: '湖南',
  909. itemStyle: {
  910. areaColor: '#0554E4',
  911. opacity: 0.2
  912. }
  913. },
  914. {
  915. name: '安徽',
  916. itemStyle: {
  917. areaColor: '#27E8FD',
  918. opacity: 0.2
  919. }
  920. },
  921. {
  922. name: '山东',
  923. itemStyle: {
  924. areaColor: '#4BFFFF',
  925. opacity: 0.2
  926. }
  927. },
  928. {
  929. name: '新疆',
  930. itemStyle: {
  931. areaColor: '#17A3F1',
  932. opacity: 0.2
  933. }
  934. },
  935. {
  936. name: '江苏',
  937. itemStyle: {
  938. areaColor: '#00b6f6',
  939. opacity: 0.2
  940. }
  941. },
  942. {
  943. name: '浙江',
  944. itemStyle: {
  945. areaColor: '#00b6f6',
  946. opacity: 0.2
  947. }
  948. },
  949. {
  950. name: '江西',
  951. itemStyle: {
  952. areaColor: '#01a4f1',
  953. opacity: 0.2
  954. }
  955. },
  956. {
  957. name: '湖北',
  958. itemStyle: {
  959. areaColor: '#005ce5',
  960. opacity: 0.2
  961. }
  962. },
  963. {
  964. name: '广西',
  965. itemStyle: {
  966. areaColor: '#0088ec',
  967. opacity: 0.2
  968. }
  969. },
  970. {
  971. name: '甘肃',
  972. itemStyle: {
  973. areaColor: '#0042df',
  974. opacity: 0.2
  975. }
  976. },
  977. {
  978. name: '山西',
  979. itemStyle: {
  980. areaColor: '#01d0fa',
  981. opacity: 0.2
  982. }
  983. },
  984. {
  985. name: '内蒙古',
  986. itemStyle: {
  987. areaColor: '#00ccf7',
  988. opacity: 0.2
  989. }
  990. },
  991. {
  992. name: '陕西',
  993. itemStyle: {
  994. areaColor: '#01b0f3',
  995. opacity: 0.2
  996. }
  997. },
  998. {
  999. name: '吉林',
  1000. itemStyle: {
  1001. areaColor: '#0051e1',
  1002. opacity: 0.2
  1003. }
  1004. },
  1005. {
  1006. name: '福建',
  1007. itemStyle: {
  1008. areaColor: '#0158e3',
  1009. opacity: 0.2
  1010. }
  1011. },
  1012. {
  1013. name: '贵州',
  1014. itemStyle: {
  1015. areaColor: '#0199ef',
  1016. opacity: 0.2
  1017. }
  1018. },
  1019. {
  1020. name: '广东',
  1021. itemStyle: {
  1022. areaColor: '#00d9fc',
  1023. opacity: 0.2
  1024. }
  1025. },
  1026. {
  1027. name: '青海',
  1028. itemStyle: {
  1029. areaColor: '#005ae4',
  1030. opacity: 0.2
  1031. }
  1032. },
  1033. {
  1034. name: '西藏',
  1035. itemStyle: {
  1036. areaColor: '#01e9fd',
  1037. opacity: 0.2
  1038. }
  1039. },
  1040. {
  1041. name: '四川',
  1042. itemStyle: {
  1043. areaColor: '#0069e8',
  1044. opacity: 0.2
  1045. }
  1046. },
  1047. {
  1048. name: '宁夏',
  1049. itemStyle: {
  1050. areaColor: '#01b0f3',
  1051. opacity: 0.2
  1052. }
  1053. },
  1054. {
  1055. name: '海南',
  1056. itemStyle: {
  1057. areaColor: '#00f0ff',
  1058. opacity: 0.2
  1059. }
  1060. },
  1061. {
  1062. name: '台湾',
  1063. itemStyle: {
  1064. areaColor: '#0067e7',
  1065. opacity: 0.2
  1066. }
  1067. },
  1068. {
  1069. name: '香港',
  1070. itemStyle: {
  1071. areaColor: '#00dafa',
  1072. opacity: 0.2
  1073. }
  1074. },
  1075. {
  1076. name: '澳门',
  1077. itemStyle: {
  1078. areaColor: '#00dafa',
  1079. opacity: 0.2
  1080. }
  1081. }
  1082. ]
  1083. },
  1084. series: [
  1085. {
  1086. name: "中国",
  1087. type: "map",
  1088. mapType: "china",
  1089. layoutCenter: ["50%", "55%"],
  1090. layoutSize: "110%",
  1091. label: {
  1092. width: 340,
  1093. height: 140,
  1094. backgroundColor: {
  1095. image: "img/tip-bg.png"
  1096. },
  1097. emphasis: {
  1098. show: true,
  1099. color: "#fff",
  1100. formatter: function(params){
  1101. var tt = formatterShow(params)
  1102. return tt;
  1103. }
  1104. },
  1105. rich: rich
  1106. },
  1107. itemStyle: {
  1108. normal: {
  1109. opacity: 0.2
  1110. },
  1111. emphasis: {
  1112. opacity: 1,
  1113. borderWidth: 2,
  1114. borderColor: '#fff'
  1115. }
  1116. },
  1117. data: [
  1118. {
  1119. name: '北京',
  1120. itemStyle: {
  1121. normal: {
  1122. areaColor: '#034DE4'
  1123. },
  1124. emphasis: {
  1125. areaColor: '#034DE4',
  1126. opacity: 0.2
  1127. }
  1128. },
  1129. label: {
  1130. show: false
  1131. }
  1132. },
  1133. {
  1134. name: '天津',
  1135. itemStyle: {
  1136. normal: {
  1137. areaColor: '#034DE4'
  1138. },
  1139. emphasis: {
  1140. areaColor: '#034DE4',
  1141. opacity: 0.2
  1142. }
  1143. },
  1144. label: {
  1145. show: false
  1146. }
  1147. },
  1148. {
  1149. name: '上海',
  1150. itemStyle: {
  1151. normal: {
  1152. areaColor: '#27E9FD'
  1153. },
  1154. emphasis: {
  1155. areaColor: '#27E9FD'
  1156. }
  1157. }
  1158. },
  1159. {
  1160. name: '重庆',
  1161. itemStyle: {
  1162. normal: {
  1163. areaColor: '#0E7DEB'
  1164. },
  1165. emphasis: {
  1166. areaColor: '#0E7DEB',
  1167. opacity: 0.2
  1168. }
  1169. },
  1170. label: {
  1171. show: false
  1172. }
  1173. },
  1174. {
  1175. name: '河北',
  1176. itemStyle: {
  1177. normal: {
  1178. areaColor: '#034DE4'
  1179. },
  1180. emphasis: {
  1181. areaColor: '#034DE4'
  1182. }
  1183. }
  1184. },
  1185. {
  1186. name: '河南',
  1187. itemStyle: {
  1188. normal: {
  1189. areaColor: '#034DE4'
  1190. },
  1191. emphasis: {
  1192. areaColor: '#034DE4'
  1193. }
  1194. }
  1195. },
  1196. {
  1197. name: '云南',
  1198. itemStyle: {
  1199. normal: {
  1200. areaColor: '#20CAF8'
  1201. },
  1202. emphasis: {
  1203. areaColor: '#20CAF8'
  1204. }
  1205. }
  1206. },
  1207. {
  1208. name: '辽宁',
  1209. itemStyle: {
  1210. normal: {
  1211. areaColor: '#034DE4'
  1212. },
  1213. emphasis: {
  1214. areaColor: '#034DE4',
  1215. opacity: 0.2
  1216. }
  1217. },
  1218. label: {
  1219. show: false
  1220. }
  1221. },
  1222. {
  1223. name: '黑龙江',
  1224. itemStyle: {
  1225. normal: {
  1226. areaColor: '#17A3F1'
  1227. },
  1228. emphasis: {
  1229. areaColor: "#17A3F1"
  1230. }
  1231. }
  1232. },
  1233. {
  1234. name: '湖南',
  1235. itemStyle: {
  1236. normal: {
  1237. areaColor: '#0554E4'
  1238. },
  1239. emphasis: {
  1240. areaColor: '#0554E4'
  1241. }
  1242. }
  1243. },
  1244. {
  1245. name: '安徽',
  1246. itemStyle: {
  1247. normal: {
  1248. areaColor: '#27E8FD'
  1249. },
  1250. emphasis: {
  1251. areaColor: '#27E8FD',
  1252. opacity: 0.2
  1253. }
  1254. },
  1255. label: {
  1256. show: false
  1257. }
  1258. },
  1259. {
  1260. name: '山东',
  1261. itemStyle: {
  1262. normal: {
  1263. areaColor: '#4BFFFF'
  1264. },
  1265. emphasis: {
  1266. areaColor: '#4BFFFF'
  1267. }
  1268. }
  1269. },
  1270. {
  1271. name: '新疆',
  1272. itemStyle: {
  1273. normal: {
  1274. areaColor: '#17A3F1'
  1275. },
  1276. emphasis: {
  1277. areaColor: '#17A3F1'
  1278. }
  1279. }
  1280. },
  1281. {
  1282. name: '江苏',
  1283. itemStyle: {
  1284. normal: {
  1285. areaColor: '#00b6f6'
  1286. },
  1287. emphasis: {
  1288. areaColor: '#00b6f6'
  1289. }
  1290. }
  1291. },
  1292. {
  1293. name: '浙江',
  1294. itemStyle: {
  1295. normal: {
  1296. areaColor: '#00b6f6'
  1297. },
  1298. emphasis: {
  1299. areaColor: '#00b6f6',
  1300. opacity: 0.2
  1301. }
  1302. },
  1303. label: {
  1304. show: false
  1305. }
  1306. },
  1307. {
  1308. name: '江西',
  1309. itemStyle: {
  1310. normal: {
  1311. areaColor: '#01a4f1'
  1312. },
  1313. emphasis: {
  1314. areaColor: '#01a4f1'
  1315. }
  1316. }
  1317. },
  1318. {
  1319. name: '湖北',
  1320. itemStyle: {
  1321. normal: {
  1322. areaColor: '#005ce5'
  1323. },
  1324. emphasis: {
  1325. areaColor: '#005ce5'
  1326. }
  1327. }
  1328. },
  1329. {
  1330. name: '广西',
  1331. itemStyle: {
  1332. normal: {
  1333. areaColor: '#0088ec'
  1334. },
  1335. emphasis: {
  1336. areaColor: '#0088ec',
  1337. opacity: 0.2
  1338. }
  1339. },
  1340. label: {
  1341. show: false
  1342. }
  1343. },
  1344. {
  1345. name: '甘肃',
  1346. itemStyle: {
  1347. normal: {
  1348. areaColor: '#0042df'
  1349. },
  1350. emphasis: {
  1351. areaColor: '#0042df'
  1352. }
  1353. }
  1354. },
  1355. {
  1356. name: '山西',
  1357. itemStyle: {
  1358. normal: {
  1359. areaColor: '#01d0fa'
  1360. },
  1361. emphasis: {
  1362. areaColor: '#01d0fa',
  1363. opacity: 0.2
  1364. }
  1365. },
  1366. label: {
  1367. show: false
  1368. }
  1369. },
  1370. {
  1371. name: '内蒙古',
  1372. itemStyle: {
  1373. normal: {
  1374. areaColor: '#00ccf7'
  1375. },
  1376. emphasis: {
  1377. areaColor: '#00ccf7'
  1378. }
  1379. }
  1380. },
  1381. {
  1382. name: '陕西',
  1383. itemStyle: {
  1384. normal: {
  1385. areaColor: '#01b0f3'
  1386. },
  1387. emphasis: {
  1388. areaColor: '#01b0f3',
  1389. opacity: 0.2
  1390. }
  1391. },
  1392. label: {
  1393. show: false
  1394. }
  1395. },
  1396. {
  1397. name: '吉林',
  1398. itemStyle: {
  1399. normal: {
  1400. areaColor: '#0051e1'
  1401. },
  1402. emphasis: {
  1403. areaColor: '#0051e1',
  1404. opacity: 0.2
  1405. }
  1406. },
  1407. label: {
  1408. show: false
  1409. }
  1410. },
  1411. {
  1412. name: '福建',
  1413. itemStyle: {
  1414. normal: {
  1415. areaColor: '#0158e3'
  1416. },
  1417. emphasis: {
  1418. areaColor: '#0158e3',
  1419. opacity: 0.2
  1420. }
  1421. },
  1422. label: {
  1423. show: false
  1424. }
  1425. },
  1426. {
  1427. name: '贵州',
  1428. itemStyle: {
  1429. normal: {
  1430. areaColor: '#0199ef'
  1431. },
  1432. emphasis: {
  1433. areaColor: '#0199ef',
  1434. opacity: 0.2
  1435. }
  1436. },
  1437. label: {
  1438. show: false
  1439. }
  1440. },
  1441. {
  1442. name: '广东',
  1443. itemStyle: {
  1444. normal: {
  1445. areaColor: '#00d9fc'
  1446. },
  1447. emphasis: {
  1448. areaColor: '#00d9fc',
  1449. opacity: 0.2
  1450. }
  1451. },
  1452. label: {
  1453. show: false
  1454. }
  1455. },
  1456. {
  1457. name: '青海',
  1458. itemStyle: {
  1459. normal: {
  1460. areaColor: '#005ae4'
  1461. },
  1462. emphasis: {
  1463. areaColor: '#005ae4',
  1464. opacity: 0.2
  1465. }
  1466. },
  1467. label: {
  1468. show: false
  1469. }
  1470. },
  1471. {
  1472. name: '西藏',
  1473. itemStyle: {
  1474. normal: {
  1475. areaColor: '#01e9fd'
  1476. },
  1477. emphasis: {
  1478. areaColor: '#01e9fd',
  1479. opacity: 0.2
  1480. }
  1481. },
  1482. label: {
  1483. show: false
  1484. }
  1485. },
  1486. {
  1487. name: '四川',
  1488. itemStyle: {
  1489. normal: {
  1490. areaColor: '#0069e8'
  1491. },
  1492. emphasis: {
  1493. areaColor: '#0069e8'
  1494. }
  1495. }
  1496. },
  1497. {
  1498. name: '宁夏',
  1499. itemStyle: {
  1500. normal: {
  1501. areaColor: '#01b0f3'
  1502. },
  1503. emphasis: {
  1504. areaColor: '#01b0f3',
  1505. opacity: 0.2
  1506. }
  1507. },
  1508. label: {
  1509. show: false
  1510. }
  1511. },
  1512. {
  1513. name: '海南',
  1514. itemStyle: {
  1515. normal: {
  1516. areaColor: '#00f0ff'
  1517. },
  1518. emphasis: {
  1519. areaColor: '#00f0ff',
  1520. opacity: 0.2
  1521. }
  1522. },
  1523. label: {
  1524. show: false
  1525. }
  1526. },
  1527. {
  1528. name: '台湾',
  1529. itemStyle: {
  1530. normal: {
  1531. areaColor: '#0067e7'
  1532. },
  1533. emphasis: {
  1534. areaColor: '#0067e7',
  1535. opacity: 0.2
  1536. }
  1537. },
  1538. label: {
  1539. show: false
  1540. }
  1541. },
  1542. {
  1543. name: '香港',
  1544. itemStyle: {
  1545. normal: {
  1546. areaColor: '#00dafa'
  1547. },
  1548. emphasis: {
  1549. areaColor: '#00dafa',
  1550. opacity: 0.2
  1551. }
  1552. },
  1553. label: {
  1554. show: false
  1555. }
  1556. },
  1557. {
  1558. name: '澳门',
  1559. itemStyle: {
  1560. normal: {
  1561. areaColor: '#00dafa'
  1562. },
  1563. emphasis: {
  1564. areaColor: '#00dafa',
  1565. opacity: 0.2
  1566. }
  1567. },
  1568. label: {
  1569. show: false
  1570. }
  1571. }
  1572. ],
  1573. },
  1574. {
  1575. name: "数据集中点",
  1576. type: "scatter",
  1577. coordinateSystem: "geo",
  1578. data: convertData(data),
  1579. symbol: point,
  1580. symbolSize: function(val) {
  1581. return val[2] / 8;
  1582. },
  1583. label: {
  1584. normal: {
  1585. formatter: "{b}",
  1586. position: "right",
  1587. show: false
  1588. },
  1589. emphasis: {
  1590. show: true
  1591. }
  1592. },
  1593. itemStyle: {
  1594. normal: {
  1595. color: "#ffff00"
  1596. }
  1597. }
  1598. }
  1599. ]
  1600. };
  1601. mapChart.setOption(option);
  1602. // 渲染全国四种数据1月份
  1603. $('#book-data').text(32);
  1604. $('#varity-data').text(114);
  1605. $('#sales-data').text(370);
  1606. $('#stock-data').text(185);
  1607. mapChart.currentIndex = -1;
  1608. var monthIndex = 0;
  1609. var bNum = 0;
  1610. var startN = 0;
  1611. var timer = null;
  1612. setVal();
  1613. // 畅销书排行
  1614. var ranktUl = $('.aside-left .top ul');
  1615. var bookLiLen = ranktUl.eq(0).children().length;
  1616. var conH = $('.aside-left .top .con-wrap').height();
  1617. var bookNum = 0;
  1618. var timer01 = null;
  1619. var overWrapEle = $('.aside-left .top .con-wrap .over-wrap');
  1620. var booktimerFn = function(bNum){
  1621. clearTimeout(timer01);
  1622. timer01 = setInterval(function(){
  1623. bookNum++;
  1624. ranktUl.eq(bNum).children().removeClass('active');
  1625. ranktUl.eq(bNum).children().eq(bookNum).addClass('active');
  1626. if(bookNum == (bookLiLen-1)){
  1627. clearInterval(timer01);
  1628. bookNum = 0;
  1629. }
  1630. },3000);
  1631. }
  1632. // 监听过渡动画回调函数
  1633. var ListenTr = function(bNum){
  1634. // 过渡动画回调,执行定时切换
  1635. var e = overWrapEle[0];
  1636. function whichTransitionEvent(){
  1637. var t,
  1638. el = document.createElement('surface'),
  1639. transitions = {
  1640. 'transition':'transitionend',
  1641. 'OTransition':'oTransitionEnd',
  1642. 'MozTransition':'transitionend',
  1643. 'WebkitTransition':'webkitTransitionEnd'
  1644. }
  1645. for(t in transitions){
  1646. if( el.style[t] !== undefined ){
  1647. return transitions[t];
  1648. }
  1649. }
  1650. }
  1651. var transitionEvent = whichTransitionEvent();
  1652. transitionEvent && e.addEventListener(transitionEvent, function() {
  1653. booktimerFn(bNum);
  1654. e. removeEventListener(transitionEvent,arguments.callee,false);//销毁事件
  1655. });
  1656. }
  1657. var numGoFn = function(monthIndex){
  1658. // 将月份填入
  1659. var curTime = '2017年' + (monthIndex+1) + '月';
  1660. $('.month-tip').text(curTime);
  1661. // 全国数据关联月份
  1662. var newBData,oldBData,newVData,oldVData,newMData,oldMData,newSData,oldSData;
  1663. newBData = allMData["book"][monthIndex];
  1664. oldBData = monthIndex == 0? allMData["book"][11]: allMData["book"][monthIndex -1];
  1665. newVData = allMData["variety"][monthIndex];
  1666. oldVData = monthIndex == 0? allMData["variety"][11]: allMData["variety"][monthIndex -1];
  1667. newMData = allMData["sales"][monthIndex];
  1668. oldMData = monthIndex == 0? allMData["sales"][11]: allMData["sales"][monthIndex -1];
  1669. newSData = allMData["stock"][monthIndex];
  1670. oldSData = monthIndex == 0? allMData["stock"][11]: allMData["stock"][monthIndex -1];
  1671. // 数据滚动效果
  1672. var options = {
  1673.   useEasing: true,
  1674.   useGrouping: true,
  1675.   separator: ',',
  1676.   decimal: '.',
  1677. };
  1678. /* var demoB = new CountUp('book-data', oldBData, newBData, 0, 2.5, options);
  1679. if (!demoB.error) {
  1680.   demoB.start();
  1681. } else {
  1682.   console.error(demoB.error);
  1683. } */
  1684. /* var demoV = new CountUp('varity-data', oldVData, newVData, 0, 2.5, options);
  1685. if (!demoV.error) {
  1686.   demoV.start();
  1687. } else {
  1688.   console.error(demoV.error);
  1689. }
  1690. var demoM = new CountUp('sales-data', oldMData, newMData, 0, 2.5, options);
  1691. if (!demoM.error) {
  1692.   demoM.start();
  1693. } else {
  1694.   console.error(demoM.error);
  1695. }
  1696. var demoS = new CountUp('stock-data', oldSData, newSData, 0, 2.5, options);
  1697. if (!demoS.error) {
  1698.   demoS.start();
  1699. } else {
  1700.   console.error(demoS.error);
  1701. } */
  1702. }
  1703. // 出版社排行
  1704. var pressNum = 0;
  1705. var timerNum = null;
  1706. var presstimerFn = function(monthIndex){
  1707. clearTimeout(timerNum);
  1708. // 先灌数据
  1709. $('.aside-left .bottom .con li').each(function(){
  1710. var cur = $(this).index();
  1711. var pressTxt = $(this).find('.short').text(pressRanking[Month[monthIndex]][cur]["pressName"]);
  1712. var hotTxt = $(this).find('.hot').text(pressRanking[Month[monthIndex]][cur]["hotVal"]);
  1713. });
  1714. var rankbUl = $('.aside-left .bottom ul');
  1715. var rankbLen = rankbUl.children().length;
  1716. timerNum = setInterval(function(){
  1717. var curLi = rankbUl.children().eq(pressNum);
  1718. curLi.children('.book-rank').addClass('pressRotate');
  1719. curLi.siblings().children('.book-rank').removeClass('pressRotate');
  1720. pressNum++;
  1721. if(pressNum > rankbLen){
  1722. pressNum = 0;
  1723. clearTimeout(timerNum);
  1724. }
  1725. },1000);
  1726. }
  1727. presstimerFn(0);
  1728. // 销售码洋排行
  1729. var html = '';
  1730. var stockRankFn = function(monthIndex){
  1731. var len = saleStockR[Month[monthIndex]].length;
  1732. $('.aside-right .area-rank ul').html('');
  1733. html = '';
  1734. for(var i = 0; i < len; i++){
  1735. var pro = saleStockR[Month[monthIndex]][i]["name"];
  1736. var val = saleStockR[Month[monthIndex]][i]["value"];
  1737. html += '<li>' +
  1738. '<span class="num">' + (i+1) + '</span>' +
  1739. '<span class="city-name">' + pro + '</span>' +
  1740. '<span class="bar">' +
  1741. '<b class="bar-in" style="width: ' + (val * 7) + '%"></b>' +
  1742. '</span>' +
  1743. '<span class="rank-value">' + val + '座' + '</span>' +
  1744. '</li>'
  1745. }
  1746. $('.aside-right .area-rank ul').html(html)
  1747. }
  1748. stockRankFn(0);
  1749. // // 饼图
  1750. var pie1 = echarts.init(document.getElementById('pie1'),'macarons');
  1751. var pie2 = echarts.init(document.getElementById('pie2'),'macarons');
  1752. var pieRich = {
  1753. big: {
  1754. fontSize: 24,
  1755. lineHeight: 40,
  1756. fontFamily: 'Rubik'
  1757. },
  1758. small: {
  1759. fontSize: 16
  1760. },
  1761. }
  1762. var pieOption1 = {
  1763. legend: {
  1764. x: 'left',
  1765. data:[],
  1766. top: '68%',
  1767. left: 'center',
  1768. itemWidth: 15,
  1769. itemHeight: 8,
  1770. textStyle: {
  1771. color: '#fff'
  1772. }
  1773. },
  1774. series: [
  1775. {
  1776. name:'销售占比',
  1777. type:'pie',
  1778. radius: ['55%', '65%'],
  1779. hoverOffset: 5,
  1780. center: ['50%','35%'],
  1781. avoidLabelOverlap: false,
  1782. color: ['#0239a7', '#fff', '#00bbec', '#23539b', '#24feb4','#1397ff'],
  1783. label: {
  1784. normal: {
  1785. show: false,
  1786. position: 'center'
  1787. }
  1788. ,
  1789. emphasis: {
  1790. show: true,
  1791. color: '#fff',
  1792. formatter: function(params, ticket, callback) {
  1793. // console.log
  1794. return '{big|' + params.value + '}{small|%}\n{small|' + params.name + '}';
  1795. },
  1796. // '{a|这段文本采用样式a}'
  1797. rich: pieRich
  1798. }
  1799. },
  1800. labelLine: {
  1801. normal: {
  1802. show: false
  1803. }
  1804. },
  1805. data:[]
  1806. }
  1807. ]
  1808. };
  1809. var pieOption2 = {
  1810. legend: {
  1811. x: 'left',
  1812. data:[],
  1813. top: '68%',
  1814. left: 'center',
  1815. itemWidth: 15,
  1816. itemHeight: 8,
  1817. textStyle: {
  1818. color: '#fff'
  1819. }
  1820. },
  1821. series: [
  1822. {
  1823. name:'库存占比',
  1824. type:'pie',
  1825. radius: ['55%', '65%'],
  1826. hoverOffset: 5,
  1827. avoidLabelOverlap: false,
  1828. color: ['#0239a7', '#fff', '#00bbec', '#23539b', '#24feb4','#1397ff'],
  1829. center: ['50%','35%'],
  1830. label: {
  1831. normal: {
  1832. show: false,
  1833. position: 'center'
  1834. }
  1835. ,
  1836. emphasis: {
  1837. show: true,
  1838. color: '#fff',
  1839. formatter: function(params, ticket, callback) {
  1840. return '{big|' + params.value + '}{small|%}\n{small|' + params.name + '}';
  1841. },
  1842. // '{a|这段文本采用样式a}'
  1843. rich: pieRich
  1844. }
  1845. },
  1846. labelLine: {
  1847. normal: {
  1848. show: false
  1849. }
  1850. },
  1851. data:[]
  1852. }
  1853. ]
  1854. };
  1855. pie1.currentIndex = -1;
  1856. pie1.setOption(pieOption1);
  1857. setInterval(function () {
  1858. var dataLen = pieOption1.series[0].data.length;
  1859. // 取消之前高亮的图形
  1860. pie1.dispatchAction({
  1861. type: 'downplay',
  1862. seriesIndex: 0,
  1863. dataIndex: pie1.currentIndex
  1864. });
  1865. pie1.currentIndex = (pie1.currentIndex + 1) % dataLen;
  1866. // 高亮当前图形
  1867. pie1.dispatchAction({
  1868. type: 'highlight',
  1869. seriesIndex: 0,
  1870. dataIndex: pie1.currentIndex
  1871. });
  1872. }, 1000);
  1873. pie2.currentIndex = -1;
  1874. pie2.setOption(pieOption2);
  1875. setInterval(function () {
  1876. var dataLen = pieOption2.series[0].data.length;
  1877. // 取消之前高亮的图形
  1878. pie2.dispatchAction({
  1879. type: 'downplay',
  1880. seriesIndex: 0,
  1881. dataIndex: pie2.currentIndex
  1882. });
  1883. pie2.currentIndex = (pie2.currentIndex + 1) % dataLen;
  1884. // 高亮当前图形
  1885. pie2.dispatchAction({
  1886. type: 'highlight',
  1887. seriesIndex: 0,
  1888. dataIndex: pie2.currentIndex
  1889. });
  1890. }, 1000);
  1891. var pieDataFn = function(monthIndex){
  1892. var curD1 = saleBL[Month[monthIndex]];
  1893. var curD2 = stockBL[Month[monthIndex]];
  1894. var len = curD1.length;
  1895. for(var i=0; i< len; i++ ){
  1896. pieOption1["legend"]["data"].push(curD1[i]["name"]);
  1897. if(curD2.length > i)
  1898. {
  1899. pieOption2["legend"]["data"].push(curD2[i]["name"]);
  1900. }
  1901. }
  1902. pieOption1.series[0].data = curD1;
  1903. pieOption2.series[0].data = curD2;
  1904. pie1.setOption(pieOption1);
  1905. pie2.setOption(pieOption2);
  1906. }
  1907. pieDataFn(0);
  1908. function setVal() {
  1909. clearTimeout(timer);
  1910. timer = setInterval(function() {
  1911. if (mapChart.currentIndex == -1 && monthIndex == 0) {
  1912. option.series[0].data = mapData[Month[0]];
  1913. mapChart.setOption(option);0
  1914. pieDataFn(monthIndex);
  1915. presstimerFn(monthIndex);
  1916. stockRankFn(monthIndex);
  1917. if(startN == 0){
  1918. booktimerFn(bNum);
  1919. }
  1920. startN++;
  1921. }
  1922. var dataLen = mapData["Jan"].length;
  1923. // 取消之前高亮的图形
  1924. mapChart.dispatchAction({
  1925. type: "downplay",
  1926. seriesIndex: 0,
  1927. dataIndex: mapChart.currentIndex
  1928. });
  1929. mapChart.currentIndex = (mapChart.currentIndex + 1) % dataLen;
  1930. // 高亮当前图形
  1931. mapChart.dispatchAction({
  1932. type: "highlight",
  1933. seriesIndex: 0,
  1934. dataIndex: mapChart.currentIndex
  1935. });
  1936. if (mapChart.currentIndex === hasData[monthIndex]) {
  1937. mapChart.currentIndex = -1;
  1938. monthIndex++;
  1939. if(monthIndex > 11){
  1940. monthIndex = monthIndex%12;
  1941. }
  1942. option.series[0].data = mapData[Month[monthIndex]];
  1943. mapChart.setOption(option);
  1944. // transition过渡动画
  1945. bNum++;
  1946. overWrapEle.addClass('go');
  1947. // debugger
  1948. if(bNum > 12){
  1949. bNum = 1;
  1950. overWrapEle.css('top',0);
  1951. overWrapEle.removeClass('go');
  1952. for(var i = 0; i < ranktUl.length; i++){
  1953. ranktUl.eq(i).children().removeClass('active');
  1954. ranktUl.eq(i).children().eq(0).addClass('active');
  1955. }
  1956. }
  1957. if(bNum == 1){
  1958. overWrapEle.removeClass('top'+ 12);
  1959. }else{
  1960. overWrapEle.removeClass('top'+ (bNum -1 ));
  1961. }
  1962. overWrapEle.addClass('top'+ bNum);
  1963. ListenTr(bNum);
  1964. pieDataFn(monthIndex);
  1965. presstimerFn(monthIndex);
  1966. stockRankFn(monthIndex);
  1967. numGoFn(monthIndex);
  1968. }
  1969. }, 2000);
  1970. }
  1971. var chinaEchartsObj = echarts.getMap('china');
  1972. var geoJSONChina = chinaEchartsObj.geoJson;
  1973. var allDefProvince = geoJSONChina.features;
  1974. for(var i = 0, len = allDefProvince.length; i < len; i++){
  1975. var sglProvinceProperties = allDefProvince[i].properties;
  1976. var sglProvinceName = sglProvinceProperties.name;
  1977. switch(sglProvinceName){
  1978. case '湖北':
  1979. sglProvinceProperties.cp[0] = 128.642464;
  1980. sglProvinceProperties.cp[1] = 34.756967;
  1981. break;
  1982. case '湖南':
  1983. sglProvinceProperties.cp[0] = 128.642464;
  1984. sglProvinceProperties.cp[1] = 34.756967;
  1985. break;
  1986. case '江西':
  1987. sglProvinceProperties.cp[0] = 128.642464;
  1988. sglProvinceProperties.cp[1] = 34.756967;
  1989. break;
  1990. case '甘肃':
  1991. sglProvinceProperties.cp[0] = 128.642464;
  1992. sglProvinceProperties.cp[1] = 34.756967;
  1993. break;
  1994. case '新疆':
  1995. sglProvinceProperties.cp[0] = 128.642464;
  1996. sglProvinceProperties.cp[1] = 34.756967;
  1997. break;
  1998. case '上海':
  1999. sglProvinceProperties.cp[0] = 128.642464;
  2000. sglProvinceProperties.cp[1] = 34.756967;
  2001. break;
  2002. case '江苏':
  2003. sglProvinceProperties.cp[0] = 128.642464;
  2004. sglProvinceProperties.cp[1] = 34.756967;
  2005. break;
  2006. case '云南':
  2007. sglProvinceProperties.cp[0] = 128.642464;
  2008. sglProvinceProperties.cp[1] = 34.756967;
  2009. break;
  2010. case '广东':
  2011. sglProvinceProperties.cp[0] = 128.642464;
  2012. sglProvinceProperties.cp[1] = 34.756967;
  2013. break;
  2014. case '浙江':
  2015. sglProvinceProperties.cp[0] = 128.642464;
  2016. sglProvinceProperties.cp[1] = 34.756967;
  2017. break;
  2018. case '河北':
  2019. sglProvinceProperties.cp[0] = 128.642464;
  2020. sglProvinceProperties.cp[1] = 34.756967;
  2021. break;
  2022. case '山东':
  2023. sglProvinceProperties.cp[0] = 128.642464;
  2024. sglProvinceProperties.cp[1] = 34.756967;
  2025. break;
  2026. case '河南':
  2027. sglProvinceProperties.cp[0] = 128.642464;
  2028. sglProvinceProperties.cp[1] = 34.756967;
  2029. break;
  2030. case '四川':
  2031. sglProvinceProperties.cp[0] = 128.642464;
  2032. sglProvinceProperties.cp[1] = 34.756967;
  2033. break;
  2034. case '内蒙古':
  2035. sglProvinceProperties.cp[0] = 128.642464;
  2036. sglProvinceProperties.cp[1] = 34.756967;
  2037. break;
  2038. }
  2039. }