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