JavaScript Chart.js - Custom data formatting to display on tooltip

前端 未结 11 2114
面向向阳花
面向向阳花 2020-12-07 20:13

I have looked at various documentation and similar questions on here, but cannot seem to find the particular solution. Apologies if I have missed anything obvious or have re

11条回答
  •  青春惊慌失措
    2020-12-07 20:57

    In chart.js 2.1.6, I did something like this (in typescript):

      let that = this;
      options = {
        legend: {
          display: false,
          responsive: false
        },
        tooltips: {
          callbacks: {
            label: function(tooltipItem, data) {
              let account: Account = that.accounts[tooltipItem.index];
              return account.accountNumber+":"+account.balance+"€";
            }
          }
        }
      }
    

提交回复
热议问题