In Chart.js, the chart title, x-axis name, and y-axis name can be set using the options object.
To set the chart title:
var chart = new Chart(ctx, {
type: 'bar',
data: {...},
options: {
title: {
display: true,
text: 'Chart Title'
},
...
}
});
To set the x-axis name:
var chart = new Chart(ctx, {
type: 'bar',
data: {...},
options: {
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: 'X-axis Name'
}
}],
...
}
}
});
To set the y-axis name:
var chart = new Chart(ctx, {
type: 'bar',
data: {...},
options: {
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Y-axis Name'
}
}],
...
}
}
});
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-11-01 11:00:00 +0000
Seen: 20 times
Last updated: Dec 20 '22
How can I use iText7 to create a PDF that includes a pie chart?
How to create a bar chart with two sets of x-axis labels?
Is it possible for the LVGL chart to show decimal values?
What is the method for creating a pie chart with three layers in R?
How can we produce a line chart that is overlaid with another chart?
How can an upper limit be added to the y-axis in Syncfusion Chart in Flutter?
What is the process for creating flow charts representing functions?
What is the process for configuring the tradingview charting library chart to update automatically?
What are the steps to create a half-moon chart using ggplot2?