I'm trying to customize the font size for a chart by changing the default value from 40px to 14px. However, when I set Chart.defaults.global.defaultFontSize to 14, the changes don't seem to take effect. Below is the code snippet for reference. Any help would be greatly appreciated!
Chart.defaults.global.defaultFontSize = 14;
let chart = new Chart(context, {
type: 'line',
options:{
animation: {
onComplete: function(e) {
angularContext.onChartRendered();
}
},
layout: {
padding: {
left: 20,
right: 40,
top: 20,
bottom: 60
}
},
title: {
text: 'Bonello Distribution',
},
legend: {
display: false,
}
},
data: {
labels: graphData.labels,
datasets: [
{
label: 'My First dataset',
data: graphData.values,
borderColor: "#3e95cd",
fill: false
}
],
},
});