0👍
To change the order of the labels in the chart, you’ll need to modify the labels property of the data object in the chart configuration.
One approach would be to sort the $categories array in the desired order before generating the labels for the chart. For example, if you want to sort the categories based on the "position" field in ascending order:
$categories.sort(function(a, b) {
return a.position - b.position;
});
labels: [
@foreach($categories as $cat)
@foreach($cat['verbatim'] as $verbatim)
'{{ $verbatim }}',
@endforeach
@endforeach
],
- Chartjs-How can I remove the left spacing between the data and the hidden ticks on the y axis
- Chartjs-Show lines with a point for ChartJS legend labels
Source:stackexchange.com