Chartjs-How can I show extra data in chart.js tooltip?

0๐Ÿ‘

I found a way to retrieve weight_id using the following function.

onClick: function clickHandler(evt, activeElements) {
  if (activeElements.length) {
    var element = this.getElementAtEvent(evt);
    var index = element[0]._index;
    var _datasetIndex = element[0]._datasetIndex;
    var weightId = weight_ids[index];
    var weightLog = weight_logs[index];
    
    console.log(index);
    console.log(weightId);
    console.log(this.data.labels[index]);
    console.log(weightLog);
    
  }
}

Leave a comment