Where put “multiTooltipTemplate” in Chart.js v2.x

后端 未结 1 782
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-13 02:49

i want to change the \"label\" for the \"datasetlabel\" width \"multiTooltipTemplate\". But i find the solution only for the previous version of chart.js

Can you tel

1条回答
  •  情话喂你
    2021-01-13 03:24

    Your options object should be

    ...
    options: {
      tooltips: {
        callbacks: {
          label: function(tooltipItem, data) {
            var datasetLabel = data.datasets[tooltipItem.datasetIndex].label || '';
            return datasetLabel + ' : ' + tooltipItem.yLabel + ' €';
          }
        }
      }
    }
    ...
    

    0 讨论(0)
提交回复
热议问题