[Chartjs]-How to Reverse Chart.js Label Order?

10๐Ÿ‘

โœ…

I think what you are looking for is the reverse option under legend which will show datasets in reverse order

http://www.chartjs.org/docs/latest/configuration/legend.html?h=reverse

enter image description here

1๐Ÿ‘

Try giving it rotation via options in the Chart object.

new Chart(context, {
type: 'doughnut',
data: {
labels: [ 'Blue', 'Red' ],
datasets: [{
          data: [7, 3],
          backgroundColor: [
          'rgba(54, 162, 235, 0.7)',
          'rgba(208, 54, 100, 0.7)',
          ],
      }]
     },
  options: {rotation: (0.5 * Math.PI)}
});

Fiddle: https://jsfiddle.net/zdh7591r/

Leave a comment