diff --git a/src/pages/achievement/info/course.vue b/src/pages/achievement/info/course.vue index 7f88582..f91682e 100644 --- a/src/pages/achievement/info/course.vue +++ b/src/pages/achievement/info/course.vue @@ -3,7 +3,7 @@
-
@@ -114,7 +114,7 @@ @@ -520,18 +520,17 @@ export default { this.$router.push(this.curTab == 1 ? `show?reportId=${row.reportId}` : `project?id=${row.projectId}&projectName=${row.goodsName}&classId=${this.curRow.classId || ''}&workNumber=${row.workNumber || row.userName}`) }, getChart () { // 初始化折线图 - const xData = Array.from({ length: 101 }, (v, k) => k) - const yData = Array.from({ length: 101 }, (v, k) => 0) + const data = {} const list = this.listDataAll const prop = this.curTab == 0 ? 'avgScore' : 'averageScore' list.map(n => { - yData[n[prop]]++ + if (!data[n[prop]]) { + data[n[prop]] = 1 + } else { + data[n[prop]]++ + } }) - return console.log(333, xData, yData) - const nums = this.stageNumber - for (const i in this.stageNumber) { - data.push(nums[i]) - } + console.log(333, data, Object.keys(data), Object.values(data)) let myChart = echarts.init(document.getElementById("chart")); myChart.setOption({ title: { text: "实验分数分布图" }, @@ -540,16 +539,22 @@ export default { name: "分数", type: "category", boundaryGap: false, - interval: 10, - data: ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", '100'] + interval: 5, + axisLabel: { + interval: 9, + }, + data: Object.keys(data) }, yAxis: { - name: this.permissions ? "人数" : '成绩报告数量', + name: this.curTab == 1 ? "人数" : '成绩报告数量', type: "value", - interval: 1 + interval: 10, + axisLabel: { + interval: 9, + }, }, series: [{ - data, + data: Object.values(data), type: "line", areaStyle: {}, color: ["#8191fd"] diff --git a/src/pages/achievement/info/project.vue b/src/pages/achievement/info/project.vue index 1d66b58..3a605d9 100644 --- a/src/pages/achievement/info/project.vue +++ b/src/pages/achievement/info/project.vue @@ -1,11 +1,14 @@