Repository navigation
[Bug] markLine设置的y值例如2.015标注在了2.019上方 #21743
Description
Version
6.1.0
Link to Minimal Reproduction
Steps to Reproduce
option = {
"tooltip": {
"trigger": "axis",
"backgroundColor": "rgba(0, 0, 0, 0.5)",
"borderColor": "rgba(0, 0, 0, 0.1)"
},
"grid": {
"x": 95,
"y": 20,
"bottom": 80,
"right": 100
},
"color": [
"#1890FF"
],
"xAxis": {
"type": "category",
"boundaryGap": false,
"data": [
"26/08/20 12:20:15",
"26/08/20 12:25:15",
"26/08/20 12:30:15",
"26/08/20 12:35:15",
"26/08/20 12:40:15",
"26/08/20 12:45:16",
"26/08/20 12:50:15",
"26/08/20 12:55:15",
"26/08/20 13:00:15",
"26/08/20 13:05:16",
"26/08/20 13:10:15",
"26/08/20 13:15:15",
"26/08/20 13:20:15",
"26/08/20 13:25:15",
"26/08/20 13:30:15",
"26/08/20 13:35:15",
"26/08/20 13:40:15",
"26/08/20 13:45:15",
"26/08/20 13:50:15",
"26/08/20 13:55:15",
"26/08/20 14:00:16",
"26/08/20 14:05:15",
"26/08/20 14:06:11",
"26/08/20 14:10:15",
"26/08/20 14:10:15",
"26/08/20 14:15:15",
"26/08/20 14:20:15",
"26/08/20 14:25:15"
],
"splitLine": {
"show": false
},
"axisTick": {
"show": false
},
"axisLine": {
"lineStyle": {
"color": "rgba(0,0,0,0.15)",
"width": 1,
"type": "dashed"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "rgba(0,0,0,0.65)"
}
}
},
"yAxis": {
"type": "value",
"scale": true,
"axisLine": {
"show": false
},
"axisTick": {
"show": false
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "rgba(0,0,0,0.65)"
}
},
"min": 2.015
},
"visualMap": {
"show": false,
"top": 0,
"right": 0,
"itemWidth": 10,
"itemHeight": 3,
"orient": "horizontal",
"pieces": [
{
"gt": -100,
"lt": 2.015,
"color": "#1890FF"
},
{
"gte": 2.015,
"color": "#FF1D25"
}
]
},
"dataZoom": [
{
"type": "inside",
"start": 0,
"end": 100
},
{
"start": 0,
"end": 100
}
],
"series": [
{
"data": [
2.024,
2.024,
2.025,
2.02,
2.026,
2.025,
2.019,
2.024,
2.023,
2.022,
2.024,
2.018,
2.02,
2.022,
2.02,
2.027,
2.026,
2.027,
2.027,
2.025,
2.027,
2.026,
2.027,
2.027,
2.029,
2.031,
2.025,
2.027
],
"type": "line",
"smooth": true,
"symbol": "circle",
"name": "水位:",
"markLine": {
"lineStyle": {
"normal": {
"color": "#FE1E1E"
}
},
"data": [
{
"yAxis": 2.015
}
],
"label": {
"normal": {
"formatter": "警戒水位2.015米"
}
}
}
}
]
}
Current Behavior
markLine is not right
Expected Behavior
markLine y value is at the right position
Environment
- OS:
- Browser:
- Framework:Any additional comments?
No response
Activity
plainheart commentedon Aug 24, 2026
应该是因为目前
markLine的小数点精度precision默认为2导致的,2.015 被四舍五入到 2.02,因此被错误地展示在 2.019 上方。可以显式设置markLine.precision为3规避该问题。DemoLijie-Gao commentedon Aug 25, 2026
markLine.precision设置后,可以解决markLine位置不对的问题