Skip to content

[Bug] markLine设置的y值例如2.015标注在了2.019上方 #21743

Open

Description

@Lijie-Gao

Version

6.1.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=line-marker&code=zVfBjtMwEL0j8Q9VuLDSshunTelG4oCAwgFOICGB9uAm3tTaJK4cd7cB7Z0LFz6CGxIIrvwNWvgMbKdpHdeOGyQQbQ_tzMvzeMZ-MyULhkkxuDd4e_PGgL88RkjG8MKLGkttpThNEeVWD65w6R0qvhmMz1NKlkXygGREYmg6g7f9w8H6cxQetJ8gNEHUigYHXg2-Wj_kpRQnWkQr_vskVFkrbgn89jqMkZybJy0z38uccSvwfW2deB3SawV9C0xO_Ol0HdJpA13dF3nQslQtkNhQDBlKCa20TfMMQVo9hiK5ZzArkepOIIPtlaU5GB_7k-PAH4AgCvwIhCrnLiJ0IYZOjqGTY-TkGHGOcScidHKEjjiGke_g4AhHHMMIODmAMw5XXTjCyeGqC0c4OVx14Qgnh6suHOHgGMm6dGWdI9wc4wiAToSrcnshnHG4assRkmMLaBRCAstFhtlTXAhZUJSi9s3JZaMEW1ejRRIitPYFjs___GnL2hk3P2dVZvC1hLDRZvk-Am0d36AvccLmQlBNzkYUE1jOUaIkSsbbFTqcocy-c0aXqoDWa6EV67-tMd-WPSytRVQdun8BsyVqiX4ZQxmMFmxXaf7Nsfg_cquGleNCNPAjH4Rayi9wuYTZM9k31bSre1WZGBFIY8tvGTFD-cvm6O54nqD1M0PVQyhGhbB6c_71DSkYzFoVX2AUI3FAtE5uSlkqiO7wMcR0bzLhlOkweTfZbo8npszaVxel3GOF6RQ8DFSJ08p4qtVLjDKviBy8lCToR625NLgocdK6NXVxGaR6xaQDFWIU3Mxu-m53TnQfHm3GKxGvtlZLnd88t4kXz2wwMmS2y26qhLBbzON-NOCkZzjq0VfttngsPGDSb1s2u8V8t2d2bHib3VaUv72upVpDU5vtjLNtVgeU1k0UQ8HuPcwJkQpp6glllc-I6CNejGnMW4MOKGAuqa8_f_vx_X20488hPTf3wX3GlHoJQnOuwVaALmaPAH9rYmYQNZuSOi69RWy3f1LX44PS5_YIQi9ZnRxzD--XmDMBYqz-a__r08frdx_qWskAf3752iNTrhmK94mr3w&enc=deflate

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

Image markLine is not right

Expected Behavior

markLine y value is at the right position

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Activity

  1. added
    enThis issue is in English
    pendingWe are not sure about whether this is a bug/new feature.
    on Aug 24, 2026
  2. plainheart commented on Aug 24, 2026

    @plainheart
    Member

    应该是因为目前 markLine 的小数点精度 precision 默认为 2 导致的,2.015 被四舍五入到 2.02,因此被错误地展示在 2.019 上方。可以显式设置 markLine.precision 为 3 规避该问题。Demo

  3. added
    has-workaroundThis issue/feature has a workaround
    and removed
    enThis issue is in English
    on Aug 24, 2026
  4. Lijie-Gao commented on Aug 25, 2026

    @Lijie-Gao
    Author

    markLine.precision设置后,可以解决markLine位置不对的问题

  5. self-assigned this
    on Aug 31, 2026
  6. added this to the 6.1.1 milestone on Aug 31, 2026
  7. removed this from the 6.1.1 milestone on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

has-workaroundThis issue/feature has a workaroundpendingWe are not sure about whether this is a bug/new feature.topic: marker

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions