Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Pie chart legend rearrangement

Hi,

I am using pie chart with label array as shown in below example. Output showing legends in reverse order as shown in image. Can I rearrange it to show 1 and then 2 and 3 …?
Capture

var data = [{
values: [19, 26, 55],
labels: [‘1. label’, ‘2. label’, ‘3. label’],
type: ‘pie’
}];

Plotly.newPlot(‘myDiv’, data);

See https://plot.ly/javascript/reference/#layout-legend-traceorder

The above answer does not help with a pie chart. Legends are ordered descending based on values… Is there really no solution to this problem??

1 Like