如何将 Echarts 中的工具提示添加到雷达指示器

时间:2021-07-08 13:23:28

标签: javascript charts data-visualization tooltip echarts

我正在尝试向雷达指示器元素添加工具提示。到目前为止,我在指标元素中尝试了 tooltip:{show:true, trigger: "item", value:"tooltipText"} 但没有运气:(,可以在下面的代码中看到。例如,如果我将鼠标悬停在“销售(Sales)”顶部,它应该显示带有“tooltipText”的工具提示.

运行代码示例:https://echarts.apache.org/examples/en/editor.html?c=radar

option = {
    title: {
        text: '基础雷达图'
    },
    legend: {
        data: ['预算分配(Allocated Budget)', '实际开销(Actual Spending)']
    },
    tooltip: {
        trigger: 'item'
    },
    radar: {
        // shape: 'circle',
        indicator: [
            { name: '销售(Sales)', max: 6500, tooltip:{show:true, trigger: "item", value:"tooltipText"}},
            { name: '管理(Administration)', max: 16000, tooltip:{show:true, trigger: "item", value:"tooltipText"}},
            { name: '信息技术(Information Technology)', max: 30000, tooltip:{show:true, trigger: "item", value:"tooltipText"}}
        ]
    },
    series: [{
        name: '预算 vs 开销(Budget vs spending)',
        type: 'radar',
        data: [
            {
                value: [4200, 3000, 20000, 35000, 50000, 18000],
                name: '预算分配(Allocated Budget)'
            },
            {
                value: [5000, 14000, 28000, 26000, 42000, 21000],
                name: '实际开销(Actual Spending)'
            }
        ]
    }]
};

1 个答案:

答案 0 :(得分:0)

只需在选项中添加“工具提示:{}”即可。像这样,您可以更改系列选项中的工具提示,就像您之前所做的一样。

代码如下所示:

npm install @react-native-community/masked-view --force

};

相关问题