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

How to get poltly onclick data object while dynamically?

We want onclick data object to do some calculations in our application related functionalities. So while doing horizontal or vertical, we need onclick data object before loading plotly component. How to get it, please help on this. We stuck and it may not be possible to achieve our functionality, if we don’t get data object dynamically. Appreciate your help. Thanks

Can you share an example on CodePen ?

In general, we will get data object while clicking on plotly individual bar, so the same data object I required while/before page(<plotlycomponent) loading it self.
<PlotlyComponent id={“XXX”} onClick={this.plotlyOnclick.bind(data, this)} data={data} layout={layout} config={config} />

plotlyOnclick(event, data){
//data is required while/before <plotlycomponent loading