Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

section_3.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. function initSubjectBadEcharts() {
  2. var xAxis_data = [
  3. "语文",
  4. "数学",
  5. "英语",
  6. "物理",
  7. "地理",
  8. "化学",
  9. "道德与法治",
  10. "历史",
  11. "生物"
  12. ];
  13. var series_data = [12, 20, 15, 8, 7, 11, 13, 15, 8];
  14. var option = {
  15. animation: false,
  16. title: {
  17. text: "人",
  18. x: "left",
  19. y: "top",
  20. textStyle: {
  21. color: "#5F6E82",
  22. fontSize: $.UnitUtil.mm2px(3),
  23. fontWeight: 500,
  24. },
  25. },
  26. color: ["#5C99FF"],
  27. legend: {
  28. itemWidth: $.UnitUtil.mm2px(2),
  29. itemHeight: $.UnitUtil.mm2px(2),
  30. top: "bottom",
  31. data: ["违纪人数"],
  32. },
  33. grid: {
  34. top: $.UnitUtil.mm2px(10),
  35. left: 0,
  36. right: 0,
  37. bottom: $.UnitUtil.mm2px(8),
  38. containLabel: true,
  39. },
  40. xAxis: [
  41. {
  42. type: "category",
  43. data: xAxis_data,
  44. axisLabel: {
  45. color: "#5F6E82", //更改坐标轴文字颜色
  46. interval: 0
  47. },
  48. axisTick: {
  49. alignWithLabel: true,
  50. },
  51. boundaryGap: true,
  52. triggerEvent: true,
  53. axisLine: {
  54. show: true, //是否显示轴线
  55. lineStyle: {
  56. color: "#DADADA", //刻度线的颜色
  57. },
  58. },
  59. },
  60. ],
  61. yAxis: [
  62. {
  63. type: "value",
  64. axisTick: {
  65. show: false, //刻度
  66. },
  67. axisLine: {
  68. show: false, //是否显示轴线
  69. lineStyle: {
  70. color: "#DADADA", //刻度线的颜色
  71. },
  72. },
  73. splitLine: {
  74. //网格线
  75. lineStyle: {
  76. type: "dotted", //设置网格线类型 dotted:虚线 solid:实线
  77. },
  78. show: true, //隐藏或显示
  79. },
  80. axisLabel: {
  81. color: "#5F6E82", //更改坐标轴文字颜色
  82. },
  83. },
  84. ],
  85. series: [
  86. {
  87. name: "违纪人数",
  88. type: "bar",
  89. barWidth: $.UnitUtil.mm2px(5),
  90. // 柱状图最小高度
  91. barMinHeight: $.UnitUtil.mm2px(2),
  92. barGap: 0,
  93. label: {
  94. normal: {
  95. show: true,
  96. align: "center",
  97. verticalAlign: "bottom",
  98. position: "top",
  99. distance: 0,
  100. formatter: "{c}",
  101. },
  102. },
  103. data: series_data,
  104. },
  105. ],
  106. };
  107. var myEcharts = echarts.init(document.querySelector(".section_3 #subjectBadEcharts"));
  108. myEcharts.clear();
  109. myEcharts.setOption(option);
  110. }
  111. $(function () {
  112. // outerHeight(true) 高度为 height+margin+padding+border
  113. var parameter = $(".section_3_html_root").data("page-params");
  114. console.log("section_3:parameter", parameter);
  115. initSubjectBadEcharts();
  116. });