You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In plain old chart.js, I can do something like this in the options:
tooltips: {callbacks: {label: function(tooltipItem,data){// get the concerned datasetvartooltipLabel=data.labels[tooltipItem.index]vardataset=data.datasets[tooltipItem.datasetIndex]// calculate the total of this data setvartotal=dataset.data.reduce(function(previousValue,currentValue,currentIndex,array){returnpreviousValue+currentValue})// get the current items valuevarcurrentValue=dataset.data[tooltipItem.index]// calculate the precentage based on the total and current item, also this does a rough rounding to give a whole numbervarprecentage=Math.floor(((currentValue/total)*100)+0.5)returntooltipLabel.replace(/-/g,' ')+': '+precentage+'%'}}}
Actual Behavior
But in vue-chartjs, it is being ignored, and/or I don't seem to be accessing the data. Is there a way I should refer to this? (I have tried the same data object name as for the chart to no avail, and also tried this._chart.data with no success)
The text was updated successfully, but these errors were encountered:
Expected Behavior
In plain old chart.js, I can do something like this in the options:
Actual Behavior
But in vue-chartjs, it is being ignored, and/or I don't seem to be accessing the data. Is there a way I should refer to this? (I have tried the same data object name as for the chart to no avail, and also tried
this._chart.data
with no success)The text was updated successfully, but these errors were encountered: