1👍
✅
What you are trying to use is old V2 syntax while you are using V3, same for your title and legend options.
You can downgrade to version 2.9.4 by running npm i chart.js@2.9.4
to make it work or you can change your defaults assignment to: Chart.defaults.font.size = 14;
Live example:
Chart.defaults.font.size = 20;
var options = {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
},
{
label: '# of Points',
data: [7, 11, 5, 8, 3, 7],
borderWidth: 1
}
]
},
options: {}
}
var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
<canvas id="chartJSContainer" width="600" height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.3.2/chart.js"></script>
</body>