chartOpt.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. const animationIsOpen = true;
  2. export function getInviTypesOption(dataList) {
  3. if (!dataList.length) return null;
  4. const chartColor = [
  5. "#2D99FF",
  6. "#4346D3",
  7. "#4D1D83",
  8. "#5E2BBC",
  9. "#6648FF",
  10. "#F43469",
  11. "#16CEB9",
  12. ];
  13. const seriesData = dataList.map((item) => {
  14. return {
  15. name: item.type,
  16. value: item.warnCount,
  17. };
  18. });
  19. return {
  20. animation: animationIsOpen,
  21. color: chartColor,
  22. grid: {
  23. top: "20%",
  24. bottom: "10%",
  25. },
  26. tooltip: {
  27. trigger: "item",
  28. formatter: "{b}<br/>{d}%",
  29. backgroundColor: "rgba(63,67,87,0.9)",
  30. padding: 10,
  31. textStyle: {
  32. fontSize: 12,
  33. color: "#E1E6EF",
  34. fontWeight: 500,
  35. lineHeight: 18,
  36. },
  37. },
  38. legend: {
  39. show: false,
  40. },
  41. series: [
  42. {
  43. name: "",
  44. type: "pie",
  45. radius: ["55%", "85%"],
  46. data: seriesData,
  47. label: {
  48. show: false,
  49. },
  50. },
  51. ],
  52. };
  53. }
  54. export function getInviAreaOption(dataList) {
  55. if (!dataList.length) return null;
  56. const chartColor = [
  57. "#6648FF",
  58. "#5E2BBC",
  59. "#4D1D83",
  60. "#4346D3",
  61. "#2D99FF",
  62. "#16CEB9",
  63. ];
  64. const seriesData = dataList.map((item) => {
  65. return {
  66. name: `${item.province},${item.warnCount}`,
  67. value: item.warnCount,
  68. };
  69. });
  70. return {
  71. animation: animationIsOpen,
  72. color: chartColor,
  73. grid: {
  74. top: "20%",
  75. bottom: "10%",
  76. },
  77. tooltip: {
  78. trigger: "item",
  79. formatter: "{b}<br/>{d}%",
  80. backgroundColor: "rgba(63,67,87,0.9)",
  81. padding: 10,
  82. textStyle: {
  83. fontSize: 12,
  84. color: "#E1E6EF",
  85. fontWeight: 500,
  86. lineHeight: 18,
  87. },
  88. },
  89. legend: {
  90. show: false,
  91. },
  92. series: [
  93. {
  94. name: "占比",
  95. type: "pie",
  96. radius: ["55%", "85%"],
  97. data: seriesData,
  98. label: {
  99. show: false,
  100. },
  101. },
  102. ],
  103. };
  104. }
  105. export function getInviTimeOption(dataList) {
  106. if (!dataList.length) return;
  107. return {
  108. animation: animationIsOpen,
  109. grid: {
  110. show: true,
  111. top: "22%",
  112. bottom: "15%",
  113. left: "8%",
  114. right: "5%",
  115. borderColor: "#292C38",
  116. },
  117. legend: {
  118. show: true,
  119. top: 17,
  120. right: 20,
  121. itemGap: 20,
  122. itemWidth: 16,
  123. itemHeight: 4,
  124. icon: "roundRect",
  125. textStyle: {
  126. color: "rgba(225, 230, 239, 0.5)",
  127. fontSize: 12,
  128. padding: [0, 0, 0, 5],
  129. },
  130. },
  131. tooltip: {
  132. show: true,
  133. trigger: "axis",
  134. backgroundColor: "rgba(63,67,87,0.9)",
  135. padding: 10,
  136. textStyle: {
  137. fontSize: 12,
  138. color: "#E1E6EF",
  139. fontWeight: 500,
  140. lineHeight: 18,
  141. },
  142. },
  143. xAxis: {
  144. type: "category",
  145. data: dataList.map((item) => item.hour),
  146. interval: 5,
  147. splitLine: {
  148. show: false,
  149. },
  150. axisLine: {
  151. lineStyle: {
  152. color: "#292C38",
  153. },
  154. },
  155. axisLabel: {
  156. color: "#E1E6EF",
  157. fontSize: 10,
  158. },
  159. axisTick: {
  160. show: true,
  161. inside: true,
  162. },
  163. },
  164. yAxis: {
  165. type: "value",
  166. splitLine: {
  167. show: true,
  168. lineStyle: {
  169. color: "#292C38",
  170. },
  171. },
  172. axisLine: {
  173. show: false,
  174. },
  175. axisLabel: {
  176. fontSize: 10,
  177. color: "#E1E6EF",
  178. },
  179. axisTick: {
  180. show: false,
  181. },
  182. },
  183. series: [
  184. {
  185. name: "在线考生",
  186. type: "line",
  187. smooth: true,
  188. showSymbol: false,
  189. data: dataList.map((item) => item.onlineCount),
  190. itemStyle: {
  191. color: "#16CEB9",
  192. },
  193. lineStyle: {
  194. width: 4,
  195. color: "#16CEB9",
  196. },
  197. },
  198. {
  199. name: "预警数量",
  200. type: "line",
  201. smooth: true,
  202. showSymbol: false,
  203. data: dataList.map((item) => item.warnCount),
  204. itemStyle: {
  205. color: "#F7517F",
  206. },
  207. lineStyle: {
  208. width: 4,
  209. color: "#F7517F",
  210. },
  211. },
  212. ],
  213. };
  214. }
  215. export function getInviMapOption(dataList) {
  216. if (!dataList.length) return;
  217. const countData = dataList.map((item) => {
  218. return {
  219. name: item.province,
  220. ...item,
  221. };
  222. });
  223. return {
  224. tooltip: {
  225. trigger: "item",
  226. formatter(params) {
  227. if (!params.data) return;
  228. const { name, onlineCount, warnCount } = params.data;
  229. return `<span style="color:#2D99FF">${name}</span><br />在线人数:${onlineCount}<br />预警总数:${warnCount}`;
  230. },
  231. backgroundColor: "rgba(63,67,87,0.95)",
  232. padding: 10,
  233. triggerOn: "click",
  234. textStyle: {
  235. fontSize: 12,
  236. color: "#E1E6EF",
  237. fontWeight: 500,
  238. lineHeight: 18,
  239. rich: {
  240. n: {
  241. color: "#2D99FF",
  242. },
  243. },
  244. },
  245. },
  246. series: [
  247. {
  248. name: "数量",
  249. type: "map",
  250. mapType: "china",
  251. layoutCenter: ["50%", "50%"],
  252. layoutSize: "100%",
  253. data: countData,
  254. itemStyle: {
  255. areaColor: "rgba(63, 67, 87, 0.4)",
  256. borderColor: "#2D99FF",
  257. borderWidth: 1,
  258. },
  259. emphasis: {
  260. label: {
  261. show: false,
  262. },
  263. itemStyle: {
  264. areaColor: "#2D99FF",
  265. },
  266. },
  267. },
  268. ],
  269. };
  270. }