[Chartjs]-Chartjs – How to access chart instance in a custom tooltip callback

2πŸ‘

βœ…

In the customTooltips function you can access the datasets by this._data.datasets. Then you can loop trough the datasets to see if borderdash exist. In the example below I used .map to create new array.

let data = this._data.datasets
let borderDash = data.map((item,index) => {
    return {
        label:item.label,
        index,
        borderDash: item.borderDash?true:false
    }  
})

console.log(borderDash)

Leave a comment