【发布时间】:2026-01-17 07:35:01
【问题描述】:
我正在使用 ApexChart,我想在工具提示中添加更多信息(在悬停时显示)。我已经阅读了文档,但我真的不明白该怎么做。
我的问题是我不明白应该在哪里添加额外的数据以及如何让它显示在工具提示中?
现在我只在工具提示中看到默认值,即系列名称和“y”值。我想看看:
- 价格:(x 值)
- 数字:(y 值)
- 产品:“名称”,
- 信息:'信息',
- 网站:“名称”
如何将其添加到工具提示中?这是我到目前为止得到的:
小提琴:https://jsfiddle.net/9m0r2ont/1/
代码:
var options = {
chart: {
height: 380,
width: "100%",
type: "scatter",
},
series: [
{
name: "Series 1",
data: [
{
x: 100,
y: 50,
product: 'name',
info: 'info',
site: 'name'
},
{
x: 150,
y: 55,
product: 'name',
info: 'info',
site: 'name'
}
]
}
],
xaxis: {
type: "numeric"
}
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
【问题讨论】:
标签: javascript tooltip apexcharts