Chartjs Tooltip Line Breaks

后端 未结 5 602
盖世英雄少女心
盖世英雄少女心 2020-12-09 15:02

Is it possible to get line breaks in chartjs tooltips?

tooltipTemplate: \"<%if (label){%><%=label%>: <%}%><%= value %>\"
5条回答
  •  我在风中等你
    2020-12-09 15:37

    This worked for me. Just simply return an array of strings as labels in tooltips.

     tooltips: {
        callbacks: {
          label: function(tooltipItem, data) {
            let label = "Line 1";
            let label2 = "Line 2";
            return [label, label2];
          }
        }
      }
    

提交回复
热议问题