I want to make a part of the labels in chartJS bold. I’ve been looking in the documentation but I cant find of any way. I hope there is someone who can help me out if it is possible at all. π Below is a picture of how I want it to work. (its made in photoshop)
So I want to make the “bar total”, “bar 1”, “bar 2”, “bar 3” and “bar 4” bold so the difference with the hours is more clear.
The labels are set in my code like this:
labels: [["bar total", "150 hour"], ["bar 1", "70 hour"], ["bar 2", "30 hour"], ["bar 3", "40 hour"], ["bar 4", "10 hour"]],
Iam using ChartJS version 2.3.0.
Any ideas?
7
Answers
You can find in http://www.chartjs.org/docs/latest/general/fonts.html
I hope it will be help you.
I’m not too familiar with chartJS but I do believe that you can add the following :
OR
References:
1) Chart js. How to change font styles for "labels" array?
Hope this helps!
Joel
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:
If you are looking for a fancy label with value processing and with some sign, bold label etc.
I hope this helps.
The labels are actually denoted by ticks , please try below solution.
Hopefully this will help you.
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!
πππ₯π₯π¨ ππ¨π«π₯π!
ππ²πΉπΉπΌ πͺπΌπΏπΉπ±!
π»ππππ πππππ!
The
fontStyle
value should be present inside theticks
object (in case ofreact-chartjs-2
).