diff --git a/src/components/Health/HealthChart.vue b/src/components/Health/HealthChart.vue index c6ca4a2..2b06183 100644 --- a/src/components/Health/HealthChart.vue +++ b/src/components/Health/HealthChart.vue @@ -59,11 +59,12 @@ const updateChart = () => { // 体重趋势统计图 const weightXAxis = healthStore.healthRecordList.map((item) => item.date).reverse() const weightYAxis = healthStore.healthRecordList.map((item) => item.weight).reverse() + const sortedRecordList = healthStore.healthRecordList.sort((a, b) => a.weight - b.weight) weightDailyChart.setOption(lineChartOptions('日期', weightXAxis, '体重(千克)', weightYAxis)) weightDailyChart.setOption({ yAxis: { - min: 60, - max: 90 + min: Math.floor(sortedRecordList[0].weight), + max: Math.ceil(sortedRecordList[sortedRecordList.length - 1].weight) } })