如何防止悬停数据显示在 Chart.JS 中?
How can I prevent the hover data from displaying in Chart.JS?
我有一个水平条形图,如下所示:
...但是当我悬停它时像这样:
我试图阻止“悬停数据”这样显示:
var priceBarChart = new Chart(ctxBarChart, {
type: 'horizontalBar',
showTooltips: false,
data: barChartData,
options: optionsBar
});
...像这样:
var optionsBar = {
scales: {
xAxes: [
{
stacked: true
}
],
yAxes: [
{
stacked: true
}
]
},
showTooltips: false
};
...但两者都不起作用 - 无论如何都会显示皱巴巴的尖端。
如何防止悬停数据显示在 Chart.JS 中?
您应该将此添加到您的选项中:
tooltips: {
enabled: false
}
更多信息here
2022 年回答:
options: {
plugins: {
tooltip: {
enabled: false
},
}
},
Documentation here 在 Charts.js
我有一个水平条形图,如下所示:
...但是当我悬停它时像这样:
我试图阻止“悬停数据”这样显示:
var priceBarChart = new Chart(ctxBarChart, {
type: 'horizontalBar',
showTooltips: false,
data: barChartData,
options: optionsBar
});
...像这样:
var optionsBar = {
scales: {
xAxes: [
{
stacked: true
}
],
yAxes: [
{
stacked: true
}
]
},
showTooltips: false
};
...但两者都不起作用 - 无论如何都会显示皱巴巴的尖端。
如何防止悬停数据显示在 Chart.JS 中?
您应该将此添加到您的选项中:
tooltips: {
enabled: false
}
更多信息here
2022 年回答:
options: {
plugins: {
tooltip: {
enabled: false
},
}
},
Documentation here 在 Charts.js