feat:增加体重图表自适应坐标轴
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user