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
I am wanting to do things such as adding center text to doughnuts as well as many other tasks which involve using plugins but I am unable to find anything relating to how to do that in php?
Any help would be appreciated.
Thanks,
John
The text was updated successfully, but these errors were encountered:
i implement data label from https://github.com/chartjs/chartjs-plugin-datalabels
i just insert the code in bottom of my script, like this <script type="text/javascript"> Chart.plugins.register({ afterDatasetsDraw: function(chart) { var ctx = chart.ctx; chart.data.datasets.forEach(function(dataset, i) { var meta = chart.getDatasetMeta(i); if (!meta.hidden) { meta.data.forEach(function(element, index) { ctx.fillStyle = 'rgb(0, 0, 0)'; var fontSize = 12; var fontStyle = 'normal'; var fontFamily = 'Helvetica Neue'; ctx.font = Chart.helpers.fontString(fontSize, fontStyle, fontFamily); var dataString = dataset.data[index].toString(); if(dataString > 0){ ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var padding = 0; var position = element.tooltipPosition(); ctx.fillText(dataString, position.x, position.y - (fontSize / 2) - padding); } }); } }); } }); </script>
I am wanting to do things such as adding center text to doughnuts as well as many other tasks which involve using plugins but I am unable to find anything relating to how to do that in php?
Any help would be appreciated.
Thanks,
John
The text was updated successfully, but these errors were encountered: