我想在工具提示中隐藏标签,因为它显示未定义

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

我正在使用chart.js来显示折线图。如何隐藏chart.js折线图的工具提示标签?工具提示中的标签显示undefined所以我想隐藏标签(请参见屏幕截图)?

也许有一种方法可以修改工具提示,我只能在工具提示中显示图例值?我的代码如下:

  myLine = new Chart(ctx).Line(lineChartData, {
      type: 'line',
      responsive: true,
      scaleShowGridLines : false,
      bezierCurve : false,
      animationEasing: "linear",
      tooltipEvents: ["mousemove", "touchstart", "touchmove"],
      showTooltips: true,
      scaleLineColor: "rgba(0,0,0,.8)",
  });

enter image description here

chart.js linechart
1个回答
6
投票

只需将tooltipTitleFontSize设置为0即可。


预习

enter image description here


脚本

myLine = new Chart(ctx).Line(lineChartData, {
    ...
    tooltipTitleFontSize: 0
});
© www.soinside.com 2019 - 2024. All rights reserved.