@kdburke wrote:
Hello, I have created a Dash app that contains a Graph element in which I have used scattermapbox to plot filled choropleths, as well as a second trace that includes point markers (also using scattermapbox).
The intended function is to then allow the user to use lasso-selection to select choropleths for plotting. Unfortunately, the interactive selection also includes points from the second trace in the selection. I understand that hoverinfo can be suppressed using ‘skip’ (e.g. https://codepen.io/etpinard/pen/BaaopPW) for the points, but when making selections these points are still included.
I have learned that the point and choropleth selected points are differentiable based on the curveNumber field in the associated dictionaries. Using the below code snippet I have successfully filtered the data selection to include only the desired points, but I receive a ‘TypeError: list indices must be integers or slices, not str’ when running the dashboard.
pts = selectedData[‘points’]
pts2 = dict(points= [i for i in pts[‘points’] if (i[‘curveNumber’] == 0)], lassoPoints=pts[‘lassoPoints’])This code works as expected when run outside of the dash app in an ipython environment.
Sample data:
pts = {‘points’: [{‘customdata’: ‘c.a’,
‘pointIndex’: 0,
‘x’: 1,
‘y’: 4,
‘curveNumber’: 0,
‘text’: ‘a’,
‘pointNumber’: 0},
{‘customdata’: ‘c.b’,
‘pointIndex’: 1,
‘x’: 2,
‘y’: 1,
‘curveNumber’: 1,
‘text’: ‘b’,
‘pointNumber’: 1}],
‘lassoPoints’: {‘mapbox’: [[-110, 45], [-100, 50]]}}
Posts: 1
Participants: 1







