score:2
Accepted answer
This can be achieved by passing the label as an array of strings where each element represents a line, e.g.:
let labels = [
'A', // normal label.
['First line', 'Second line', '...'] // multi-line label.
];
A working example:
new Chart(document.getElementById("chart"), {
type: 'bar',
data: {
labels: ['A', ['Water', 'Heating'], 'C'],
datasets: [{
data: [1, 1, 1]
}]
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<canvas id="chart"></canvas>
Source: stackoverflow.com
Related Query
- ChartJS, Multiple line in bar chart label
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- show label in tooltip but not in x axis for chartjs line chart
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- Line chart is showing under bar in combochart in chartjs
- How to draw Horizontal line on Bar Chart Chartjs
- X-axis multiple colored label for bar chart using chart.js
- Multiple stacked bar chart using ChartJs
- Set fixed label size for grouped bar chart in angular Chartjs
- ChartJS 2.9.4 can't overlay line data on Horizontal Bar chart
- Plot Multiple Line Chart in Ionic 3 with ChartJS
- ChartJS line chart or bar graph from a Java program
- Using ChartJS to create a multiple grouped bar chart - see picture below
- How to remove a label in top of bar in chartjs chart
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- Draw stacked horizontal bar chart with Average line using ChartJS
- PrimeFaces: ChartJs stacked bar chart label removal
- Chartjs line chart gets all scrambled up when an x value coincides with a label
- How to add vertical line in bar chart using chartJs and ng2-charts?
- combo bar line chart with multiple grouped/stacked datasets
- Chartjs Bar Chart showing old data when hovering
- Chart Js Change Label orientation on x-Axis for Line Charts
- Chartjs v2.0: stacked bar chart
- ChartJS - Draw chart with label by month, data by day
- Changing fontFamily on ChartJS bar chart
- Display line chart with connected dots using chartJS
- chartjs : how to set custom scale in bar chart
- Chartjs Bar Chart Legend
- chartjs show dot point on hover over line chart
- ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip
More Query from same tag
- Hide labels on x-axis ChartJS
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- chartjs resizing very quickly (flickering) on mouseover
- How to make bars dashed in chart js?
- ng2-charts & chart.js - Change background color
- Side effects from Chartjs for only *some* clients
- Loop through multiple rows as labels and data in chart.js and PHP
- Split assoc array by keys
- Display data label (legend) in line-chart using chartjs
- Chart doesn't render in angular 2 app
- Multiple chart on one page using chart.js and Flask app
- Align Title Left React Chart.js V2
- Align rotated text to left of canvas
- How to sum value by month and assign two different variables?
- chartjs cutoutPercentage and tooltips does not works in nextjs
- ChartJS and jsPDF - why the background is black?
- How to take data from an API and create a chart on that using Chart.js and Angular 8?
- Storybook: Changing the value of the control doesnot rerender the Chart.js canvas
- undefined labels piechart - chartjs
- Width and Height in Chart.js
- chart.js radar scaleShowLine for each scaleLine
- hiding x-axes labels with 0 values on a bar chart
- chart.js display even intervals between two dates and adding label to y axes
- How do I change the grid line style on the Y axis in Chart.js?
- Chart.js 2.0 - Tooltip is showing incomplete data on hover
- Chart.js - Horizontal line on Bar chart interferes with tooltip
- Data Visualization DataTables.js using chart.js
- Legends in Chart Js don't appears
- How to get dynamic popover element after inserted to DOM?
- How to add images to chart labels with vue-chartjs?