oneQualified.jsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * @Author: dayan_hjm 一次合格率
  3. * @Date: 2023-10-23 09:32:12
  4. * @Last Modified by: dayan_hjm
  5. * @Last Modified time: 2023-10-23 10:47:46
  6. */
  7. import React, { useState, useEffect, Component } from "react";
  8. import styles from "../style.less";
  9. import { useHistory, useLocation, withRouter } from "react-router-dom";
  10. import mod from '../mod';
  11. @withRouter
  12. class BottomLineForSend extends Component {
  13. // 构造函数,组件的实例创建时,最先执行
  14. constructor(props, context) {
  15. super(props, context);
  16. this.store = mod;
  17. this.state = {
  18. };
  19. }
  20. componentDidMount() {
  21. this.setData();
  22. }
  23. setData() {
  24. setTimeout(() => {
  25. // 基于准备好的dom,初始化echarts实例
  26. var myChart = echarts.init(document.getElementById('echarts5'));
  27. var option = {
  28. tooltip: {
  29. trigger: 'axis',
  30. axisPointer: { type: 'shadow' },
  31. }, "grid": {
  32. "top": "15%",
  33. "right": "10%",
  34. "bottom": "20",
  35. "left": "10%",
  36. },
  37. legend: {
  38. data: ['目标一次及格率', '实际一次及格率'],
  39. right: 'center',
  40. top: 0,
  41. textStyle: {
  42. color: "#fff"
  43. },
  44. itemWidth: 12,
  45. itemHeight: 10,
  46. },
  47. "xAxis": [
  48. {
  49. "type": "category",
  50. data: ['2016', '2017', '2018', '2019'],
  51. axisLine: { lineStyle: { color: "rgba(255,255,255,.1)" } },
  52. axisLabel: {
  53. textStyle: { color: "rgba(255,255,255,.7)", fontSize: '14', },
  54. },
  55. },
  56. ],
  57. "yAxis": [
  58. {
  59. "type": "value",
  60. "name": "单位1",
  61. "show": true,
  62. axisTick: { show: false },
  63. "axisLabel": {
  64. "show": true,
  65. color: "rgba(255,255,255,.6)"
  66. },
  67. axisLine: { lineStyle: { color: 'rgba(255,255,255,.1)' } },//左线色
  68. },
  69. {
  70. "type": "value",
  71. "name": "单位2",
  72. "show": true,
  73. axisTick: { show: false },
  74. "axisLabel": {
  75. "show": true,
  76. formatter: "{value}",
  77. color: "rgba(255,255,255,.6)"
  78. },
  79. axisLine: { lineStyle: { color: 'rgba(255,255,255,.1)' } },//右线色
  80. splitLine: { show: true, lineStyle: { color: 'rgba(255,255,255,.1)' } },//x轴线
  81. },
  82. ],
  83. "series": [
  84. {
  85. "name": "目标一次及格率",
  86. "type": "line",
  87. "yAxisIndex": 1,
  88. "data": [66, 16.8, 1.33, 12.65],
  89. lineStyle: {
  90. normal: {
  91. width: 2
  92. },
  93. },
  94. "itemStyle": {
  95. "normal": {
  96. "color": "#69FFDE",
  97. }
  98. },
  99. "smooth": true
  100. },
  101. {
  102. "name": "实际一次及格率",
  103. "type": "line",
  104. "yAxisIndex": 1,
  105. "data": [0, 11.48, 18.00, 25.65],
  106. lineStyle: {
  107. normal: {
  108. width: 2
  109. },
  110. },
  111. "itemStyle": {
  112. "normal": {
  113. "color": "#FFCE00",
  114. }
  115. },
  116. "smooth": true
  117. }
  118. ]
  119. };
  120. // 使用刚指定的配置项和数据显示图表。
  121. myChart.setOption(option);
  122. window.addEventListener("resize", function () {
  123. myChart.resize();
  124. });
  125. }, 200)
  126. }
  127. render() {
  128. return (
  129. <div className={["eacharView cbBottomLineForSend"]}>
  130. <div id="echarts5"></div>
  131. </div>
  132. )
  133. }
  134. }
  135. export default BottomLineForSend;