You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

section_2_lin.js 7.3KB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. $(function () {
  2. // 按名次统计
  3. function initClassCriticalRankEcharts() {
  4. var legend_data = [">10名", "≤10名"];
  5. var xAxis_data = ["全部班级", "九年级一班", "九年级二班"];
  6. var series_data1 = [7, 4, 3];
  7. var series_data2 = [-4, -2, -2];
  8. var option = {
  9. title: {
  10. text: "人",
  11. x: "left",
  12. y: "top",
  13. textStyle: {
  14. color: "#5F6E82",
  15. fontSize: 12,
  16. fontWeight: 500
  17. }
  18. },
  19. color: ["#5C99FF", "#F39A2C"],
  20. legend: {
  21. itemWidth: 6,
  22. itemHeight: 6,
  23. bottom: 30,
  24. data: legend_data
  25. },
  26. grid: {
  27. top: 30,
  28. left: 5,
  29. right: 0,
  30. bottom: 65,
  31. containLabel: true
  32. },
  33. xAxis: [
  34. {
  35. type: "category",
  36. offset: 10,
  37. position: "bottom",
  38. data: xAxis_data,
  39. axisLabel: {
  40. color: "#5F6E82" //更改坐标轴文字颜色
  41. },
  42. axisTick: {
  43. alignWithLabel: true
  44. },
  45. boundaryGap: true,
  46. triggerEvent: true,
  47. axisLine: {
  48. show: true, //是否显示轴线
  49. lineStyle: {
  50. color: "#DADADA" //刻度线的颜色
  51. }
  52. }
  53. }
  54. ],
  55. yAxis: [
  56. {
  57. type: "value",
  58. axisTick: {
  59. show: false //刻度
  60. },
  61. axisLine: {
  62. show: false, //是否显示轴线
  63. lineStyle: {
  64. color: "#DADADA" //刻度线的颜色
  65. }
  66. },
  67. splitLine: {
  68. //网格线
  69. lineStyle: {
  70. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  71. },
  72. show: true //隐藏或显示
  73. },
  74. axisLabel: {
  75. color: "#5F6E82" //更改坐标轴文字颜色
  76. }
  77. }
  78. ],
  79. series: [
  80. {
  81. name: legend_data[0],
  82. type: "bar",
  83. stack: "one",
  84. barWidth: 32,
  85. // 柱状图最小高度
  86. barMinHeight: 0,
  87. barGap: 0,
  88. label: {
  89. normal: {
  90. show: true,
  91. align: "center",
  92. verticalAlign: "bottom",
  93. position: "top",
  94. distance: 0
  95. }
  96. },
  97. data: series_data1
  98. },
  99. {
  100. name: legend_data[1],
  101. type: "bar",
  102. stack: "one",
  103. barWidth: 32,
  104. // 柱状图最小高度
  105. barMinHeight: 0,
  106. barGap: 0,
  107. label: {
  108. normal: {
  109. show: true,
  110. align: "center",
  111. verticalAlign: "top",
  112. position: "bottom",
  113. distance: 0,
  114. formatter: function (params) {
  115. return Math.abs(params.value);
  116. }
  117. }
  118. },
  119. data: series_data2
  120. }
  121. ]
  122. };
  123. var myEcharts = echarts.init(document.querySelector(".section_2_lin #classCriticalRankEcharts"));
  124. myEcharts.clear();
  125. myEcharts.setOption(option);
  126. }
  127. // 按分数统计
  128. function initClassCriticalScoreEcharts() {
  129. var legend_data = [">10分", "≤10分"];
  130. var xAxis_data = ["全部班级", "九年级一班", "九年级二班"];
  131. var series_data1 = [7, 4, 3];
  132. var series_data2 = [-4, -2, -2];
  133. var option = {
  134. title: {
  135. text: "人",
  136. x: "left",
  137. y: "top",
  138. textStyle: {
  139. color: "#5F6E82",
  140. fontSize: 12,
  141. fontWeight: 500
  142. }
  143. },
  144. color: ["#5C99FF", "#F39A2C"],
  145. legend: {
  146. itemWidth: 6,
  147. itemHeight: 6,
  148. bottom: 30,
  149. data: legend_data
  150. },
  151. grid: {
  152. top: 30,
  153. left: 5,
  154. right: 0,
  155. bottom: 65,
  156. containLabel: true
  157. },
  158. xAxis: [
  159. {
  160. type: "category",
  161. offset: 10,
  162. position: "bottom",
  163. data: xAxis_data,
  164. axisLabel: {
  165. color: "#5F6E82" //更改坐标轴文字颜色
  166. },
  167. axisTick: {
  168. alignWithLabel: true
  169. },
  170. boundaryGap: true,
  171. triggerEvent: true,
  172. axisLine: {
  173. show: true, //是否显示轴线
  174. lineStyle: {
  175. color: "#DADADA" //刻度线的颜色
  176. }
  177. }
  178. }
  179. ],
  180. yAxis: [
  181. {
  182. type: "value",
  183. axisTick: {
  184. show: false //刻度
  185. },
  186. axisLine: {
  187. show: false, //是否显示轴线
  188. lineStyle: {
  189. color: "#DADADA" //刻度线的颜色
  190. }
  191. },
  192. splitLine: {
  193. //网格线
  194. lineStyle: {
  195. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  196. },
  197. show: true //隐藏或显示
  198. },
  199. axisLabel: {
  200. color: "#5F6E82" //更改坐标轴文字颜色
  201. }
  202. }
  203. ],
  204. series: [
  205. {
  206. name: legend_data[0],
  207. type: "bar",
  208. stack: "one",
  209. barWidth: 32,
  210. // 柱状图最小高度
  211. barMinHeight: 0,
  212. barGap: 0,
  213. label: {
  214. normal: {
  215. show: true,
  216. align: "center",
  217. verticalAlign: "bottom",
  218. position: "top",
  219. distance: 0
  220. }
  221. },
  222. data: series_data1
  223. },
  224. {
  225. name: legend_data[1],
  226. type: "bar",
  227. stack: "one",
  228. barWidth: 32,
  229. // 柱状图最小高度
  230. barMinHeight: 0,
  231. barGap: 0,
  232. label: {
  233. normal: {
  234. show: true,
  235. align: "center",
  236. verticalAlign: "top",
  237. position: "bottom",
  238. distance: 0,
  239. formatter: function (params) {
  240. return Math.abs(params.value);
  241. }
  242. }
  243. },
  244. data: series_data2
  245. }
  246. ]
  247. };
  248. var myEcharts = echarts.init(document.querySelector(".section_2_lin #classCriticalScoreEcharts"));
  249. myEcharts.clear();
  250. myEcharts.setOption(option);
  251. }
  252. var parameter = $(".section_2_html_root .section_2_lin_html_root").data("page-params");
  253. parameter = JSON.parse(parameter);
  254. var subjectInfo = [];
  255. var subjectid_ranktype = {};
  256. for(var sid_3 in parameter[3]) {
  257. if (sid_3 === "zf") {
  258. subjectInfo.unshift({
  259. subjectid: sid_3,
  260. subjectname: "全科"
  261. });
  262. } else {
  263. subjectInfo.push({
  264. subjectid: sid_3,
  265. subjectname: parameter[3][sid_3].subjectname
  266. });
  267. }
  268. if (!subjectid_ranktype[sid_3]) {
  269. subjectid_ranktype[sid_3] = {};
  270. }
  271. subjectid_ranktype[sid_3][3] = parameter[3][sid_3];
  272. }
  273. for(var sid_4 in parameter[4]) {
  274. if (!subjectid_ranktype[sid_4]) {
  275. subjectid_ranktype[sid_4] = {};
  276. }
  277. subjectid_ranktype[sid_4][4] = parameter[4][sid_4];
  278. }
  279. console.log("subjectid_ranktype", subjectid_ranktype);
  280. var singleRootHtml = "";
  281. $.each(subjectInfo, function(s_index, s_item) {
  282. if (s_index === 0) {
  283. console.log("s_index", s_index);
  284. console.log("s_item", s_item);
  285. }
  286. });
  287. $(".section_2_lin_root").html(singleRootHtml);
  288. initClassCriticalRankEcharts();
  289. initClassCriticalScoreEcharts();
  290. });