Draw a polygon and get the area m2

Hi all,

I have a question.
With plotly I create a graph that contains different series.

In this graph I can already draw a line and get the slope, horizontal length and total length. Based on the corrcect scale the graph is using.

To make it even better I would like to be able to draw a closed polygon in the graph that will give me the area of that polygon.

As in the below example:

Can someone help me with this?