How do I change the font color of this chart in chart.js?
can anybody help me
this is my code:
const ctx = document.getElementById('chart');
// Chart.defaults.color = '#000';
new Chart(ctx, {
type: 'bar',
data: {
labels: ['JS', 'Html', 'Css', 'Node.js', 'Java', ],
datasets: [{
label: 'How much I master each language',
data: [60, 70, 40, 10, 30],
borderWidth: 1,
backgroundColor: '#09dbbf',
color: '#faebd7'
}],
label:{
}
},
options: {
title:{
display:true,
fontSize:30,
text:"How much I master each language",
color: '#faebd7',
fontColor:'#faebd7'
},
scales: {
y: {
beginAtZero: true,
},
},
}
});
Chart.defaults.color = '#f00';
I’m a beginner in programming
I’ve looked at the library documentation and haven’t found anything that helps me.
New contributor
LG .i1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
You have all the info in the documentation (https://www.chartjs.org/docs/latest/configuration/title.html)
For example, if you want the title with red color:
options: {
...
plugins: {
title: {
text: "Title of chart",
display: true,
color: "#ff0000"
}
}
}