取值修改
This commit is contained in:
@@ -44,6 +44,24 @@ const init = () => {
|
||||
itemStyle: { opacity: 0 }, //去圆点
|
||||
right: 70
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
formatter: (params: any) => {
|
||||
if (!params || params.length === 0) return ''
|
||||
|
||||
// 使用第一个项目的轴标签作为时间标题
|
||||
let tooltipText = params[0].axisValueLabel + '<br/>'
|
||||
|
||||
// 遍历所有项目并累加到tooltipText中
|
||||
params.forEach((item: any) => {
|
||||
// 将数值格式化为保留两位小数
|
||||
const formattedValue = Math.round(item.value[1] * 100) / 100
|
||||
tooltipText += `${item.marker} ${item.seriesName}: ${formattedValue}<br/>`
|
||||
})
|
||||
|
||||
return tooltipText
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'time',
|
||||
axisLabel: {
|
||||
|
||||
Reference in New Issue
Block a user