score:-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.
score: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
},
},
],
}
}
score: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';
score: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.
score: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! πππ₯π₯π¨ ππ¨π«π₯π! ππ²πΉπΉπΌ πͺπΌπΏπΉπ±! π»ππππ πππππ!
score:6
score:11
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
Source: stackoverflow.com
Related Query
- Chart.js: Make part of labels bold
- chart.js: How do I make the radar chart axis labels bigger?
- How to make labels on both side from horizontal bar chart js
- Limit labels number on Chart.js line chart
- Chart.js Show labels on Pie chart
- Chartjs random colors for each part of pie chart with data dynamically from database
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- How can I make two of my lines in Chart JS thicker
- Can't make chart js responsive
- chart.js: Show labels outside pie chart
- Chart.js how to show cursor pointer for labels & legends in line chart
- Chart JS data labels getting cut
- Make the X-Axis labels in chart.js increment by a certain scale
- How can I make a stepline or stepped chart in chart.js or D3?
- How to display Line Chart dataset point labels with Chart.js?
- Making the labels responsive in chart js
- Make Chart.js horizontal bar labels multi-line
- Chart.js - Draw bar chart with multiple labels
- Chart JS grouped sub labels
- Make pie chart smaller Chart JS
- Display a limited number of labels only on X-Axis of Line Chart using Chart.js
- Angular-chart.js - Make line chart does not curve
- Changing x axis labels in Chart.js line chart
- How to display data labels outside in pie chart with lines in ionic
- Line chart with large number of labels on X axis
- Center point labels between ticks (Polar Area Chart JS)
- How to align Chart.JS line chart labels to the center
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- How to display the labels in doughnut chart using ng2 charts?
- how to make a chart.js bar chart scrollable
More Query from same tag
- DevExtreme Exporter prints blank page
- How to reduce the distance between yAxes in Chart.js?
- Chart js display empty plot
- Connecting points between missing data in chart.js
- How to make labels clickable in angular-chart
- Chart.js 3.x not able to display data on chart
- How to make multiple stacked charts to share the same yAxis?
- Pie chart inside doughnut on same canvas
- how to display text information on hover in chart js?
- Negative bar chart of highcharts in chartjs
- Vuejs data not showing properly on mounted
- How do you add custom text to tooltips in charts.js
- Why does putting two data sets with a Time Cartesian axis in Chart.js cause two Y axis tick sets?
- Chartjs export chart without html
- How to order a horizontal bar chart - chartJS & Chart.HorizontalBar.js
- How add the sizes of the slices in the pie chart (at the top) in Chart.js?
- How to implement chart js using viewbag in mvc razor
- chartjs improvement display label
- vue-chartjs how to load data
- Prevent scroll when calling update()
- Chart.js - Creating a single bar chart with states
- Set minimum step size in chart js
- How to display final point value in charts.js
- Chart section is empty
- Redraw Chart.js with PHP JSON
- Can't increase font size in google bar chart
- Char.js - How to show labels by default in pie chart
- Chartjs bar-chart does not render when values are equal
- How can I add background color of length bars in chart (chartJS)?
- Can you set bar thickness to align with the x-axis scale in ChartJS?