Tee graph with ES documents

I am having some ES documents. These docs are related to each other as parent-child by a field called step_id. For example, doc 1 has step_id=0, doc 2 has step_id=1, doc 3,4,5 have step_id=2, doc 5,6,7,8 have step_id=3 (let’s say doc 3 has two children doc 5 and 6 - and I take another field called timestamp to determine which step_id has immediate previous step_id-1 to find its right parent). I created a tree graph using Vega on top of Kibana. Can I create something similar in Grafana?
I tried with Diagram in Grafana dashboard but not fully succeeded. I could create a single chain there displaying the nodes for each step_i where particular metric duration is Max. But, this is not coming as a tree graph and not showing all the nodes. Can it be possible to dynamically search all docs from ES using MermaidJS and then build the tree graph. I am flexible to choose any other custom graph also if it is possible to create such type of view.