Javascript ChartJS,禁用多图数据上一个绘图的工具提示

Javascript ChartJS,禁用多图数据上一个绘图的工具提示,javascript,charts,chart.js,Javascript,Charts,Chart.js,如何在我的多重打印图上禁用其中一个打印上的工具提示,但保留其他打印。 我尝试在我不想要工具提示的绘图上将“showToolTip”设置为false,但这不起作用 let ctx = document.getElementById('myChart').getContext('2d'); var chart = new Chart(ctx, { type: 'scatter', data

如何在我的多重打印图上禁用其中一个打印上的工具提示,但保留其他打印。 我尝试在我不想要工具提示的绘图上将“showToolTip”设置为false,但这不起作用

let ctx = document.getElementById('myChart').getContext('2d');
                var chart = new Chart(ctx, {
                    type: 'scatter',
                    data :{
                        labels : cLabels,
                        datasets : [{
                            label: 'Points',
                            backgroundColor: 'rgb(255, 99, 132)',
                            borderColor: 'rgb(255, 99, 132)',
                            pointStyle: 'circle',
                            pointRadius: 10,
                            data : cData,
                            showTooltips: false, //<- THis line does not work, and there is a global property to remove all tooltips
                            order: 2,
                        },{
                            label: '',
                            backgroundColor: 'rgb(255, 255, 255)',
                            borderColor: 'rgb(255, 255, 255)',
                            pointStyle: 'circle',
                            pointRadius: 5,
                            data : cData,

                            order: 1,
                        },{
让ctx=document.getElementById('myChart').getContext('2d');
var图表=新图表(ctx{
键入:“散布”,
数据:{
标签:克拉贝尔,
数据集:[{
标签:'点',
背景颜色:“rgb(255,99,132)”,
边框颜色:“rgb(255,99,132)”,
pointStyle:'圆',
点半径:10,
数据:cData,
showTooltips:false,//您可以使用函数。如果应显示工具提示,则返回
true
,否则返回
false
。以下示例指定仅应为第一个数据集显示工具提示

options: {
  ...
  tooltips: {
    filter: tooltipItem => tooltipItem.datasetIndex == 0
  }
请看下面的可运行代码示例

const数据=[
{ 
系列:[
{日期:'2020-01',值:5},
{日期:'2020-02',值:20},
{日期:'2020-03',值:10},
{日期:'2020-04',值:15}
]
},
{
系列:[
{日期:'2020-01',值:10},
{日期:'2020-02',值:8},
{日期:'2020-03',值:16},
{日期:'2020-04',值:12}
]
}
];
新图表(document.getElementById('canvas'){
键入:“行”,
数据:{
数据集:[{
标签:数据[0]。名称,
填充:假,
背景颜色:“红色”,
边框颜色:“红色”,
数据:数据[0].series.map(x=>({x:newdate(x.Date),y:x.value}))
}, {
标签:数据[1]。名称,
填充:假,
背景颜色:“蓝色”,
边框颜色:“蓝色”,
数据:data[1].series.map(x=>({x:newdate(x.Date),y:x.value}))
}]
},
选项:{
回答:是的,
标题:{
显示:假
},
图例:{
显示:假
},
工具提示:{
筛选器:tooltipItem=>tooltipItem.datasetIndex==0
},
比例尺:{
xAxes:[{
键入:“时间”,
时间:{
单位:月,
显示格式:{
“月”:“MM YYYY”,
},
工具提示格式:“MMM YYYY”
}
}],
}
}
});