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

Accessing redux store, and pulling data from that store

right now I am using dash to host my app. I currently have a candlestick chart where I highlight a specific region of the chart.

My goal is to be able to some how access the redux store, and pull in the data that is highlighted for mathematical calculations. The below pic shows an example pertaining to some of the data that is highlighted inside of redux.

Is there some type of python function that can achieve this? If not, can this be done in JS? Thanks!

Hi @skelly,

I just moved your question to the Dash forums category so the right folks are more likely to see it. Good luck!

-Jon

I use selectedData quite a bit with dash. The dcc.Graph component makes selectedData prop available through a callback.

From https://dash.plot.ly/interactive-graphing :

@app.callback(
    Output('selected-data', 'children'),
    [Input('basic-interactions', 'selectedData')])
def display_selected_data(selectedData):
    return json.dumps(selectedData, indent=2)

You can also access the data through the new javascript clientside callbacks. Obviously, a client-side callback is faster with the drawback that you expose your analytical “business logic.”

app.clientside_callback(
    ClientsideFunction('clientside', 'function_analyze_selected_data'),
    Output('selected-data', 'children'),
    [Input('button-run', 'n_clicks')],
    [State('basic-interactions', 'selectedData')]
)

Thanks man. Works perfectly now!

What is the name of the editor in the picture?