This commit is contained in:
@zuopngfei 2025-07-24 17:24:08 +08:00
parent 96f78218d6
commit 7a79249535

View File

@ -1,6 +1,9 @@
import * as echarts from '../../ec-canvas/echarts.min'; import * as echarts from '../../ec-canvas/echarts.min';
import request from '~/api/request'; import request from '~/api/request';
import { heightList, weightList } from './heightWeight'; import {
heightList,
weightList
} from './heightWeight';
const app = getApp(); const app = getApp();
Page({ Page({
@ -32,10 +35,7 @@ Page({
articlesLength: 0, articlesLength: 0,
heightData: [], heightData: [],
weightData: [], weightData: [],
heightChart: null,
weightChart: null,
directChart: null,
indirectChart: null,
carList: [], carList: [],
carLength: 0, carLength: 0,
userInfo: {}, userInfo: {},
@ -43,6 +43,11 @@ Page({
directBilirubin: [], directBilirubin: [],
xAxis: [] xAxis: []
}, },
heightChart: null,
weightChart: null,
directChart: null,
indirectChart: null,
standardHeight: [], standardHeight: [],
standardWeight: [], standardWeight: [],
userId: '', userId: '',
@ -179,11 +184,25 @@ Page({
const chartComp = this.selectComponent('#mychart-dom-height'); const chartComp = this.selectComponent('#mychart-dom-height');
if (chartComp) { if (chartComp) {
chartComp.init((canvas, width, height, dpr) => { chartComp.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr }); const chart = echarts.init(canvas, null, {
width,
height,
devicePixelRatio: dpr
});
canvas.setChart(chart); canvas.setChart(chart);
chart.setOption({ chart.setOption({
title: { text: '', left: 'left', fontSize: 6 }, title: {
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' }, text: '',
left: 'left',
fontSize: 6
},
grid: {
containLabel: true,
top: '5%',
left: '5%',
right: '7%',
bottom: '3%'
},
tooltip: { tooltip: {
show: true, show: true,
trigger: 'axis', trigger: 'axis',
@ -192,10 +211,21 @@ Page({
return `${param.axisValue}\n${param.seriesName}: ${param.value} cm`; return `${param.axisValue}\n${param.seriesName}: ${param.value} cm`;
} }
}, },
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis }, xAxis: {
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } }, type: 'category',
series: [ boundaryGap: false,
{ data: this.data.xAxis
},
yAxis: {
x: 'center',
type: 'value',
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
series: [{
name: '实际身高', name: '实际身高',
type: 'line', type: 'line',
smooth: true, smooth: true,
@ -206,20 +236,32 @@ Page({
type: 'line', type: 'line',
symbol: 'none', symbol: 'none',
data: standardUpper, data: standardUpper,
lineStyle: { opacity: 0 }, lineStyle: {
opacity: 0
},
stack: '标准范围', stack: '标准范围',
areaStyle: { opacity: 0 }, areaStyle: {
tooltip: { show: true } opacity: 0
},
tooltip: {
show: true
}
}, },
{ {
name: '标准下界', name: '标准下界',
type: 'line', type: 'line',
symbol: 'none', symbol: 'none',
data: standardLower, data: standardLower,
lineStyle: { opacity: 0 }, lineStyle: {
opacity: 0
},
stack: '标准范围', stack: '标准范围',
areaStyle: { color: 'rgba(135,206,250,0.3)' }, areaStyle: {
tooltip: { show: true } color: 'rgba(135,206,250,0.3)'
},
tooltip: {
show: true
}
} }
] ]
}); });
@ -248,11 +290,25 @@ Page({
const chartComp = this.selectComponent('#mychart-dom-weight'); const chartComp = this.selectComponent('#mychart-dom-weight');
if (chartComp) { if (chartComp) {
chartComp.init((canvas, width, height, dpr) => { chartComp.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr }); const chart = echarts.init(canvas, null, {
width,
height,
devicePixelRatio: dpr
});
canvas.setChart(chart); canvas.setChart(chart);
chart.setOption({ chart.setOption({
title: { text: '', left: 'left', fontSize: 6 }, title: {
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' }, text: '',
left: 'left',
fontSize: 6
},
grid: {
containLabel: true,
top: '5%',
left: '5%',
right: '7%',
bottom: '3%'
},
tooltip: { tooltip: {
show: true, show: true,
trigger: 'axis', trigger: 'axis',
@ -261,10 +317,21 @@ Page({
return `${param.axisValue}\n${param.seriesName}: ${param.value} kg`; return `${param.axisValue}\n${param.seriesName}: ${param.value} kg`;
} }
}, },
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis }, xAxis: {
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } }, type: 'category',
series: [ boundaryGap: false,
{ data: this.data.xAxis
},
yAxis: {
x: 'center',
type: 'value',
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
series: [{
name: '实际体重', name: '实际体重',
type: 'line', type: 'line',
smooth: true, smooth: true,
@ -275,20 +342,32 @@ Page({
type: 'line', type: 'line',
symbol: 'none', symbol: 'none',
data: standardUpper, data: standardUpper,
lineStyle: { opacity: 0 }, lineStyle: {
opacity: 0
},
stack: '标准范围', stack: '标准范围',
areaStyle: { opacity: 0 }, areaStyle: {
tooltip: { show: true } opacity: 0
},
tooltip: {
show: true
}
}, },
{ {
name: '标准下界', name: '标准下界',
type: 'line', type: 'line',
symbol: 'none', symbol: 'none',
data: standardLower, data: standardLower,
lineStyle: { opacity: 0 }, lineStyle: {
opacity: 0
},
stack: '标准范围', stack: '标准范围',
areaStyle: { color: 'rgba(135,206,250,0.3)' }, areaStyle: {
tooltip: { show: true } color: 'rgba(135,206,250,0.3)'
},
tooltip: {
show: true
}
} }
] ]
}); });
@ -303,11 +382,25 @@ Page({
const chartComp = this.selectComponent('#mychart-dom-direct'); const chartComp = this.selectComponent('#mychart-dom-direct');
if (chartComp) { if (chartComp) {
chartComp.init((canvas, width, height, dpr) => { chartComp.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr }); const chart = echarts.init(canvas, null, {
width,
height,
devicePixelRatio: dpr
});
canvas.setChart(chart); canvas.setChart(chart);
chart.setOption({ chart.setOption({
title: { text: '', left: 'left', fontSize: 6 }, title: {
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' }, text: '',
left: 'left',
fontSize: 6
},
grid: {
containLabel: true,
top: '5%',
left: '5%',
right: '7%',
bottom: '3%'
},
tooltip: { tooltip: {
show: true, show: true,
trigger: 'axis', trigger: 'axis',
@ -316,10 +409,21 @@ Page({
return `${param.axisValue}\n${param.seriesName}: ${param.value} μmol/L`; return `${param.axisValue}\n${param.seriesName}: ${param.value} μmol/L`;
} }
}, },
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis }, xAxis: {
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } }, type: 'category',
series: [ boundaryGap: false,
{ data: this.data.xAxis
},
yAxis: {
x: 'center',
type: 'value',
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
series: [{
name: '总胆红素', name: '总胆红素',
type: 'line', type: 'line',
smooth: true, smooth: true,
@ -339,11 +443,25 @@ Page({
const chartComp = this.selectComponent('#mychart-dom-indirect'); const chartComp = this.selectComponent('#mychart-dom-indirect');
if (chartComp) { if (chartComp) {
chartComp.init((canvas, width, height, dpr) => { chartComp.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, { width, height, devicePixelRatio: dpr }); const chart = echarts.init(canvas, null, {
width,
height,
devicePixelRatio: dpr
});
canvas.setChart(chart); canvas.setChart(chart);
chart.setOption({ chart.setOption({
title: { text: '', left: 'left', fontSize: 6 }, title: {
grid: { containLabel: true, top: '5%', left: '5%', right: '7%', bottom: '3%' }, text: '',
left: 'left',
fontSize: 6
},
grid: {
containLabel: true,
top: '5%',
left: '5%',
right: '7%',
bottom: '3%'
},
tooltip: { tooltip: {
show: true, show: true,
trigger: 'axis', trigger: 'axis',
@ -352,10 +470,21 @@ Page({
return `${param.axisValue}\n${param.seriesName}: ${param.value} μmol/L`; return `${param.axisValue}\n${param.seriesName}: ${param.value} μmol/L`;
} }
}, },
xAxis: { type: 'category', boundaryGap: false, data: this.data.xAxis }, xAxis: {
yAxis: { x: 'center', type: 'value', splitLine: { lineStyle: { type: 'dashed' } } }, type: 'category',
series: [ boundaryGap: false,
{ data: this.data.xAxis
},
yAxis: {
x: 'center',
type: 'value',
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
series: [{
name: '直接胆红素', name: '直接胆红素',
type: 'line', type: 'line',
smooth: true, smooth: true,