A new attribute in all traces called legendrank which defaults to the index of the trace in the data array. The legend items will then be sorted by legendrank (ties broken by index in the data array) before being laid out.
As an example for:
data = [
{name: "A", legendrank: 2}
{name: "D", legendrank: 4, legendgroup: "G2"}
{name: "E", legendrank: 4, legendgroup: "G2"}
{name: "B", legendrank: 1, legendgroup: "G1"}
{name: "C", legendrank: 3, legendgroup: "G1"}
]
then I would expect the legend order to be: G1(B,C), A, G2(D,E).
Note that the group order matters in the example above, when this will be coupled with #5260 and/or legendgroupgap.
A new attribute in all traces called
legendrankwhich defaults to the index of the trace in thedataarray. The legend items will then be sorted bylegendrank(ties broken by index in thedataarray) before being laid out.As an example for:
then I would expect the legend order to be:
G1(B,C), A, G2(D,E).Note that the group order matters in the example above, when this will be coupled with #5260 and/or
legendgroupgap.