Kibana dashboard for span metrics

Good day, we have, based on apm metrics, "time spent by span type" dashboard.


Can you please provide a calculation or formula for this dashboard? We would like to have it also in grafana.
Thanks in advance.