项目报表修改
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-12-30 10:24:50 +08:00
parent 264f00f5a8
commit 040814c3d6
1 changed files with 50 additions and 19 deletions

View File

@ -33,7 +33,7 @@
import BaseContainer from '@/components/BaseContainer'
let echarts = require('echarts/lib/echarts');
// require('echarts/lib/chart/line');
require('echarts/lib/component/markLine');
require('echarts/lib/chart/funnel');
require('echarts/lib/chart/bar');
//
@ -158,7 +158,8 @@ export default {
}
},
legend: {
data: obj.legendData
data: obj.legendData,
bottom: 0
},
series: [
{
@ -262,7 +263,9 @@ export default {
type: 'shadow'
}
},
legend: {},
legend: {
bottom: 0
},
xAxis: [
{
type: 'category',
@ -306,16 +309,17 @@ export default {
let obj2 = {
xAxisData: [],
seriesData: [],
medianValue: 0,
unit: this.$t("trials:reportForms:cjart:unit:DaysDiff"),
titleText: this.$t("trials:reportForms:cjart:title:dataDistribution"),
}
if (OtherInfo.PDList && OtherInfo.PDList.length > 0) {
OtherInfo.PDList.forEach(item => {
obj.xAxisData.push(item.SubjectCode)
obj.seriesData.push(item.DaysDiff)
obj2.xAxisData.push(item.SubjectCode)
obj2.seriesData.push(item.DaysDiff)
})
}
obj2.medianValue = this.calculateMedian(obj2.seriesData)
this.initChart_bottom(obj)
this.initChart_bottom_right(obj2)
}
@ -373,29 +377,56 @@ export default {
xAxis: {
type: 'category',
data: obj.xAxisData
// data: ['aaa', 'bbb', 'ccc']
},
yAxis: {
name: obj.unit,
type: 'value'
},
series: [
{
series: {
markLine: {
// symbol: ['none', 'none'], // 线
label: {
show: true,
position: 'end', // 线
formatter: `${this.$t('trials:reportForms:cjart:data:median')}: {c}` // 使 {c} yAxis
},
data: [
{
type: 'average', name: this.$t("trials:reportForms:cjart:data:average")
name: this.$t('trials:reportForms:cjart:data:median'),
// yAxis
yAxis: obj.medianValue,
lineStyle: {
type: 'dashed', // 线
color: this.color[7]
}
}
]
},
data: obj.seriesData,
// data: [1, 2, 3],
type: 'bar',
barWidth: 20,
}
]
};
// 4. 使
this.chart_bottom_right.setOption(option);
},
calculateMedian(numbers) {
// 1.
const sorted = [...numbers].sort((a, b) => a - b);
const middle = Math.floor(sorted.length / 2);
// 2.
if (sorted.length % 2 === 0) {
//
return (sorted[middle - 1] + sorted[middle]) / 2;
} else {
//
return sorted[middle];
}
}
}
}
</script>