12π
Iβm not too familiar with chartJS but I do believe that you can add the following :
Chart.defaults.global.defaultFontStyle = 'Bold'
OR
options: {
scale: {
pointLabels :{
fontStyle: "bold",
}
}
}
References:
1) Chart js. How to change font styles for "labels" array?
Hope this helps!
Joel
6π
- [Chartjs]-Chart.js β Styling Legend
- [Chartjs]-Chart Js Change Label orientation on x-Axis for Line Charts
3π
You need to use directly the UTF-8 characters. I am working on different graphs now and the tool which is available at https://yaytext.com/bold-italic/ helped me a lot.
For example, the following words were created by the tool, see the source code, they are without any HTML formatting:
Hello World!
πππ₯π₯π¨ ππ¨π«π₯π!
ππ²πΉπΉπΌ πͺπΌπΏπΉπ±!
π»ππππ πππππ!
2π
I just tried this. Any acceptable values from the link below should work
https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
Ex:
Chart.defaults.global.defaultFontStyle = '600';
2π
If you are looking for a fancy label with value processing and with some sign, bold label etc.
labels: {
render:function (args) {
if (args.value != 0)
return +(parseFloat(args.value).toFixed(2)) + "hrs";
},
fontStyle: "bold",
fontColor: 'black',
position : 'outside'
}
I hope this helps.
1π
The fontStyle
value should be present inside the ticks
object (in case of react-chartjs-2
).
const options = {
scales: {
xAxes: [
{
ticks: {
fontColor: '#2c2c2c', // X-Axis font color
fontStyle: 'bold', // X-Axis font style
},
},
],
}
}
1π
Updating as of version: 4.3.0:
(Example: I want to update the labels of y axis and make them bold)
scale:{
y:{
ticks:{
font:{
weight: 'bold'
}
}
}
}
-1π
Chart.defaults.global.defaultFontColor = 'red';
let chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
legend: {
labels: {
// This more specific font property overrides the global property
fontColor: 'black'
}
}
}
});
You can find in http://www.chartjs.org/docs/latest/general/fonts.html
I hope it will be help you.
- [Chartjs]-Chart Js Change Label orientation on x-Axis for Line Charts
- [Chartjs]-Hide points in ChartJS LineGraph