Legend rank per pie slice by my-tien · Pull Request #7723 · plotly/plotly.js

This PR makes it possible to pass arrays to the pie property 'legendrank' so that legend rank assignment can be configured per slice.

Previously, traces.pie.legendrank only accepted one value that applied for all slices. With this PR, slice legend entries can be individually ranked in the legend. E.g. the below JSON would produce the displayed chart:

{
  "data": [
    {
      "type": "pie",
      "values": [1, 2, 3, 4, 5],
      "labels": ["E", "D", "C", "B", "A"],
      "legendrank": [5, 4, 3, 2, 1]
    }
  ],
  "layout": {
    "width": 500,
    "height": 400,
    "legend": {
      "title": {
        "text": "A legend"
      }
    }
  }
}

This feature is not expected to work when pie values are not set.

Disclaimer I am required to add that…

the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.