Kevin
Kevin

Reputation: 113

How to change the sequence of the legend in chartJs PIE Chart?

I have Created a Pie chart using ChartJs. There has legend in follwing order

But I want to change it to

Have any way to do that?

Here is the Config part in PIE chart ...........

    {
  dataRequest: [],// data has here
  config: [{                                                              
      legend: {display: true, position: 'right'},
      responsive: false,  
      plugins: { datalabels: { display: false } },
      tooltips: {
        enabled: false
      }  
    }

Upvotes: 0

Views: 434

Answers (1)

lalit
lalit

Reputation: 91

This one can help - https://www.chartjs.org/docs/latest/configuration/legend.html?h=reverse

"reverse" key does the job

Upvotes: 1

Related Questions