This commit is contained in:
@zuopngfei 2025-07-04 16:27:58 +08:00
parent 186c8b0bc5
commit 1279df678a
2 changed files with 370 additions and 366 deletions

File diff suppressed because it is too large Load Diff

View File

@ -54,9 +54,9 @@ onMounted(() => {
var option;
let standardList = []
if(props.sex == 1){
standardList = props.label ? heightList.boy : weightList.boy
standardList = props.label == '身高' ? heightList.boy : weightList.boy
} else {
standardList = props.label ? heightList.girl : weightList.girl
standardList = props.label == '身高' ? heightList.girl : weightList.girl
}
let totalList = []
standardList.forEach(item => {
@ -64,14 +64,11 @@ onMounted(() => {
if(item.age == item2) {
totalList.push(item.value)
}
})
})
const standardLower = totalList.map(item => item[0]);
const standardUpper = totalList.map(item => item[1]);
const standardRange = standardUpper.map((up, i) => up - standardLower[i]);
option = {
grid: {
left: '50',
@ -82,14 +79,21 @@ onMounted(() => {
tooltip: {
trigger: 'axis',
formatter: function(params) {
console.log(params);
let result = params[0].axisValue + '<br/>';
params.forEach(param => {
result += param.seriesName + ': ' + param.value + ' cm<br/>';
if(props.label == '身高'){
result += param.seriesName + ': ' + param.value + ' cm<br/>';
} else if(props.label == '体重'){
result += param.seriesName + ': ' + param.value + ' kg<br/>';
}
// result += param.seriesName + ': ' + param.value + props.label == '' ? ' cm<br/>' : 'kg<br/>' ;
});
return result;
}
},
legend: {
show: false,
data: props.legendData
},
xAxis: {
@ -117,24 +121,24 @@ onMounted(() => {
}
},
{
name: '标准下界',
name: '标准上限',
type: 'line',
symbol: 'none',
data: standardUpper,
lineStyle: { opacity: 0 },
stack: '标准范围',
areaStyle: { opacity: 0 },
tooltip: { show: true }
},
{
name: '标准下限',
type: 'line',
symbol: 'none',
data: standardLower,
lineStyle: { opacity: 0 },
stack: '标准范围',
areaStyle: { opacity: 0 },
tooltip: { show: false }
},
{
name: '标准范围',
type: 'line',
symbol: 'none',
data: standardRange,
lineStyle: { opacity: 0 },
stack: '标准范围',
areaStyle: { color: 'rgba(135,206,250,0.3)' },
tooltip: { show: false },
tooltip: { show: true },
itemStyle: {
color: 'rgba(135,206,250,0.3)'
}