修改按单批次饼图鼠标聚焦提示

This commit is contained in:
Qi 2025-03-22 19:07:09 +08:00
parent c123a87789
commit 56cff6ecdd
1 changed files with 15 additions and 1 deletions

View File

@ -54,6 +54,7 @@
<script> <script>
//import { pagination } from 'mock/_util'; //import { pagination } from 'mock/_util';
import { red } from '@ant-design/colors';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import * as echarts from 'echarts'; import * as echarts from 'echarts';
@ -326,18 +327,31 @@
this.participate_Piechartloading = true; this.participate_Piechartloading = true;
this.tableloading = true; this.tableloading = true;
let result = await defHttp.get({ url: url, params: queryParams }); let result = await defHttp.get({ url: url, params: queryParams });
let totalRate = 0;
for (let key in result.gradeData) {
totalRate += parseFloat(result.gradeData[key].passRate);
}
console.log(totalRate, 'totalRate');
console.log(result, 'result'); console.log(result, 'result');
let chartsData = []; let chartsData = [];
for (let key in result.gradeData) { for (let key in result.gradeData) {
chartsData.push({ chartsData.push({
name: key + '级', name: key + '级',
value: result.gradeData[key].passRate, value: (parseFloat(result.gradeData[key].passRate) / totalRate) * 100,
}); });
} }
let option = { let option = {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
conginee: false, conginee: false,
formatter: function (params) {
return params.name + ': ' + params.value.toFixed(1) + '%';
},
textStyle: {
color: '#ec2e30', //
fontSize: 14, //
fontWeight: 'bold', //
},
// //
itemStytle: { itemStytle: {
// //