You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Plotly图表工具提示添加更多数据失效问题咨询

解决Plotly散点图customdata占位符不显示实际值的问题

你的问题核心是customdata的结构格式不符合Plotly的要求:Plotly要求customdata按单个数据点的维度组织行结构,而非你当前使用的同类型数据聚合的列结构。

修正后的代码

{
    "name": "PARAM01_STEP_MEAN",
    "type": "scatter",
    "x": [
        "2024-07-05 08:48:35",
        "2024-07-05 08:48:46"
    ],
    "y": [
        "202.072",
        "195.636"
    ],
    "customdata": [
        [
            "LOT_20240705084818519",
            "WF#1",
            "RCP#_01",
            "2"
        ],
        [
            "LOT_20240705084818519",
            "WF#1",
            "RCP#_01",
            "1"
        ]
    ],
    "hovertemplate": "<span>Sum Param: PARAM01_STEP_MEAN</span><br>\n<span>Sum Time: %{x}</span><br>\n<span>Lot ID: %{customdata[0]}</span><br>\n<span>Wafer ID: %{customdata[1]}</span><br>\n<span>Recipe ID: %{customdata[2]}</span><br>\n<span>Step ID: %{customdata[3]}</span><br>\n<span>Value: %{y}</span>\n<extra></extra>"
}

关键修改说明

  • 重构customdata结构:把原来4组同类型数据的列数组,改成2组对应单个数据点的行数组,每组包含该点的所有自定义字段(Lot ID、Wafer ID、Recipe ID、Step ID)。
  • 修复模板语法错误:补上了你原代码中Sum Time行未闭合的<span>标签,同时统一用标准的<br>标签换行(原代码混用</br>,虽不报错但不符合规范)。

修改后,鼠标悬停时就能正常显示customdata对应的实际值。

内容的提问来源于stack exchange,提问作者Sao Bui Van

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 22:03:19