score:2
Accepted answer
you can use multiline labels for that by providing the labbels in an array like so:
var options = {
type: 'line',
data: {
labels: [
[
"red",
"second line"
],
[
"blue",
"second line"
],
[
"yellow",
"second line"
],
[
"green",
"second line"
],
[
"purple",
"second line"
],
[
"orange",
"second line"
]
],
datasets: [{
label: '# of votes',
data: [12, 19, 3, 5, 2, 3],
borderwidth: 1
},
{
label: '# of points',
data: [7, 11, 5, 8, 3, 7],
borderwidth: 1
}
]
},
options: {
scales: {
yaxes: [{
ticks: {
reverse: false
}
}]
}
}
}
var ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
new chart(ctx, options);
<body>
<canvas id="chartjscontainer" width="600" height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.4/chart.js"></script>
</body>
Source: stackoverflow.com
Related Query
- is there a way to change the dispaly of a date
- is there a way to change the date format in php?
- Is there any way to change the font color and size of labels in Chartjs 3.0.0
- Is there a way to change part of the title to another font style or set a custom title format in Chart.js?
- Is there a way to change the react-chart-js tooltip only on a graph?
- Is there any way to change the font size of labels in bar chart in Chart.js v3?
- Is there a more optimized way to implement the change function of chart js upon changing the dropdowns?
- How do I change the 'months' language displayed on the date axis in Chart JS?
- I am using Chart.js and want to change the tool tip to display date format based on timestamp input
- Is there a way to adjust only the bottom padding of a chart's title in Chart.js?
- Is there any way to use 2 different color for the same bar in a chart?
- Is there a way to change color of a chart's grid in y-axis - ng2-charts
- Is there a way to make a view run without having to show the view in the browser in laravel?
- Is there any way to get y of specific x which not belongs to the dataset in Chart.js graph?
- Is there a way to give a pie chart in chart.js a different color outer border than the border color between segments?
- Is there a way to represent date hole in chartjs time series?
- Is there a way to align title and legend on the same line?
- My data array has null values in chart.js. Is there a way to draw a line between the two segments to maintain visual progress?
- Is there any way to show a tooltip for points which are not visible on the chart in Chart.js?
- ChartJs: Is there a way to control the font options per line for a multiline axis label
- Is there a way to have the tooltips always shown on a pie/doughnut in Chart.js v3?
- In ng 2 chart during the load an undefined legend gets created automatically ,Is there any way to remove it?
- Is There any way to show image on top of the stacked bar, Am getting image on every color Instead of that i need only on top of each bar
- Is there a way to display legend's data over the chart in chart.js?
- Change the Y-axis values from real numbers to integers in Chart.js
- ChartJS – is there any way to remove blank space around pie charts?
- What's the most effective way to implement a radar plot with 50 points at arbitrary locations using chart.js
- how to change the Y-axis values from float number to integer in chartjs?
- Chart.js v2 is there a way to draw bar chart horizontally?
- How to change the color of Chart.js points depending on the label
More Query from same tag
- Data Labels on top of points in line charts
- React Native Updating State with Api
- Chart.js add direction arrows to the X and Y axes
- Django Chart.js
- (Angular Ionic) How can I stream my custom data with chartjs-plugin-streaming?
- Retrieve value returned from a function in Angular
- How to update with animation a Pie Chart?
- "The radius provided (-0.5) is negative" when used with Modal
- Remove all borders from my chart in angular-chart-js
- chart.js how to make x-axis labels position top
- Group data from CSV (D3.js & Chart.js)
- JS Chart: do not merge duplicate x axis labels
- How to disable canvas elements from hijacking mouse wheel when scrolling through a page?
- Chart.js 2.0 - vertical lines
- How to pass values to a chart (chart.js / morris.js)
- How to customize the title and tooltip in ux-chartjs?
- Chart.js Radar chart legend label font size doesn't work
- Javascript not showing up total value in middle of Oracle APEX Donut chart
- How do I force Chart.js axes min and max with react-chartjs-2?
- How to create vertical arbitrary line in financial chart?
- Set animation dynamically in Chart.JS
- How could be the best way of implementing a 3D fft chart?
- JavaScript. Find the sum of a certain parameter in an array to produce a popup if that sum == 0
- How do I type string in the tooltip in Chart.js?
- Using lodash to prepare data for "last day user registration" chart
- Is it possible to scale Chart.js background Image
- How can I format the x-axis using a timestamp via chart.js?
- Programmatically creating labels for Chart.js in angular?
- Why doesn't parsing option work in chartjs?
- Multiple instances of vue-chartjs