✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Extracting trace properties

When I click on a point in one of my chart the following data is generated: {‘points’: [{‘curveNumber’: 1, ‘pointNumber’: 2, ‘pointIndex’: 2, ‘x’: 2009, ‘y’: 13.8947}]}

So what I need to do is to get the data for curveNumber so I can use it in subsequent callbacks. This post appears to provide the answer, however when I try to follow the example in that post I get an error that the object has no property by that name, i.e.
my_graph = app.layout[‘reading_gap_ethnicity_by_year’]
my_graph.available_properties

[‘id’, ‘responsive’, ‘clickData’, ‘clickAnnotationData’, ‘hoverData’, ‘clear_on_unhover’, ‘selectedData’, ‘relayoutData’, ‘extendData’, ‘restyleData’, ‘figure’, ‘style’, ‘className’, ‘animate’, …]

the ‘figure’ property probably has what i want, but…
f = my_graph[‘figure’]
KeyError

…or…
f = my_graph.figure
AttributeError: ‘Graph’ object has no attribute ‘figure’

What am I doing wrong here?

I was able to solve this by using guidance found in this post.

The solution that I was able to implement was to pass the figure data for the graph as another argument to the callback. I.e.
@app.callback(
Output(‘my_div’, ‘children’)
, [Input(‘reading_gap_ethnicity_by_year’, ‘clickData’)
, Input(‘reading_gap_ethnicity_by_year’, ‘figure’)]) <- pass in the figure data
def do_something_with_selections(values, figureData):

… now extract the selected point from ‘values’ and its name from ‘figureData’

The approach I referenced in my original post still does not work.

…hope this helps someone else…