如何将数据集标签放入 multiTooltipTemplate?如何将、放入、标签、数据

2023-09-07 11:31:19 作者:作业被我养的白白的

当前 dataset 元素有颜色,但是如何将当前 dataset 标签放入 tooltip,从 xAxis 交换标签?

There is a color of current dataset element, but how can I put current dataset label into tooltip, exchange for label from xAxis?

推荐答案

在您的选项中将 multiTooltipTemplate 设置为 "<%=datasetLabel%> : <%= value %>" 以执行此操作.

In your options set multiTooltipTemplate to "<%=datasetLabel%> : <%= value %>" to do this.

来自这个 Github 问题:https://github.com/nnnick/Chart.js/issues/535

From this Github issue : https://github.com/nnnick/Chart.js/issues/535