如何隐藏 xAxis 标题显示的工具提示

问题描述 投票:0回答:1

我希望隐藏为 xAxis 标题显示的工具提示,但当用户将鼠标悬停在轴标签和数据点上时仍然能够显示相同的工具提示。

这是我的 xAxes 配置供参考:

[
    {
        "id": "c1",
        "type": "CategoryAxis",
        "title": {
            "text": "am"
        },
        "renderer": {
            "line": {
                "isMeasured": false
            },
            "grid": {
                "template": {
                    "disabled": true
                }
            },
            "labels": {
                "template": {
                    "rotation": -45,
                    "horizontalCenter": "right",
                    "verticalCenter": "middle",
                    "truncate": true,
                    "maxWidth": 300,
                    "dy": -10,
                    "adapter": [
                        {
                            "key": "text"
                        }
                    ]
                }
            },
            "minGridDistance": 20
        },
        "tooltipText": "",
        "dataFields": {
            "category": "am"
        },
        "cursorTooltipEnabled": true
    } ]

最初的行为是,每次我将鼠标悬停在轴标题上时,之前悬停的数据点/标签的值都会显示为标题的工具提示。后来我将 tooltipText 值更改为空字符串,这似乎有效。但现在每次其中一个数据点为 0 时,要么不显示工具提示,要么在下一个数据点上显示工具提示。

amcharts amcharts4 amcharts5
1个回答
0
投票

tooltipText
设置为 null 以告诉 amCharts 不要使用任何文本作为轴标题的工具提示。

x轴配置:

{
    "id": "c1",
    "type": "CategoryAxis",
    "title": {
        "text": "am"
    },
    // ... other properties ...
    "tooltipText": null, // Disable tooltip for axis title
    "dataFields": {
        "category": "am"
    },
    "cursorTooltipEnabled": true // Enable tooltips for data points and labels
}
© www.soinside.com 2019 - 2024. All rights reserved.