Black Lives Matter. Please consider donating to Black Girls Code today.

Plot radial annotation line / Shape onto pie graph

Hi, was trying to work out the easiest way of adding a radial line from centre of the plotly pie graph to the outside as an annotation.

I am trying to annotate a percentage donut chart with benchmarks, see attached. I have been trying to do with with the plotly.js Shapes but am finding it a bit custom to do this, and wondered if there was an obvious method I am missing to achieve this. See the Super Skin and IAB annotations on the attached image.

I tried to simplify this example by (for starters) plotting a line from the centre of the pie to the cirumference, at a specific angle, but am finding it hard.

52 PM

There’s no easy way, but you should be to achieve the desired output using shapes and annotations'.

See example: https://codepen.io/etpinard/pen/YxZXRj?editors=0010

Thanks Etienne for that example. I managed to do something with using two data arrays and overlaying them, indicating the benchmarks with small data segments. The problem with annotations like this is I;m not very confident in the trigonometry I;d need to position the annotation at the correct point on the chart to indicate the benchmark percent. But I may have another go late. Thanks for your time.