Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function drawBarValues() {
// render the value of the chart above the bar
const { ctx } = this.chart;
ctx.font = Chart.helpers.fontString(
Chart.defaults.global.defaultFontSize,
'normal',
Chart.defaults.global.defaultFontFamily
);
ctx.fillStyle = this.chart.config.options.defaultFontColor;
ctx.textAlign = 'center';
ctx.textBaseline = 'center';
this.data.datasets.forEach(function(dataset) {
for (let i = 0; i < dataset.data.length; i += 1) {
if (
(dataset && !dataset.hidden === true) ||
dataset._meta[Object.keys(dataset._meta)[0]].hidden !== false
) {
const model =
dataset._meta[Object.keys(dataset._meta)[0]].data[i]._model;
if (dataset.data[i] !== null) {