St.deck_gl_chart parameters

If I understand correctly, you are busy further developing the connection to deck_gl so the API and functionality may be in flux. I noticed that with this code:

layers = [
{“data”: these_cars, “type”: “ScatterplotLayer”, “opacity”:0.1, “getRadius”: 200, “getFillColor”:[0,0,0]},
{“data”: these_pickups, “type”: “ScatterplotLayer”, “opacity”:0.1, “getRadius”:100, “getFillColor”:[50,255,50]},
{“data”: these_dropoffs, “type”: “ScatterplotLayer”, “opacity”:1.0, “getRadius”:50, “getFillColor”:[255,0,0]}
]
st.deck_gl_chart(viewport=viewport, layers=layers)

That “getRadius” has no effect and the last “opacity” setting overrides the setting for all layers. Am I defining the layers incorrectly?

Also, do you intend to support selecting features (items) of layers?

Hi @davideps,

Looks like you have a number of questions here…

you can use a “getRadius” field to individually set the radius of each circle in the plot. So here you would set “getRadius”: “my_column” where “my_column” is the name of the column containing the radius data.

Example usage: https://github.com/streamlit/streamlit/blob/develop/lib/streamlit/hello/demos.py#L79

  • opacity: could you post a full code snippet so I can copy/paste and debug your code? Including data for these_cars, etc…

  • selecting features/items of layers: apologies but I’m not sure exactly what you mean, could you explain this a bit further?

Thanks @Jonathan_Rhone. By selecting features, I mean allowing users to select one or more dots in a scatterplot (for example) to change their display color, to calculate an average value, or to exclude them from further calculations.

Hi @davideps,

Selecting features in a chart is not currently supported, but is being discussed/designed internally!

Here are some similar threads from users about this functionality:

Please let us know if you’ll be providing sample code to resolve your opacity issue!

Just wanted to drop in and mention that we’re soon going to deprecate st.deck_gl_chart in favor of st.pydeck_chart.

st.deck_gl_chart uses an API we threw together in a rush in order to support DeckGL (which is a JavaScript library) in Python, and frankly that API is just not that great.

But in the time since we implemented that feature a new Python package called PyDeck has popped up which does a much better job at creating DeckGL specs from Python! So we’ll be migrating to that ASAP.

I expect this to land in Streamlit in a week or two.

Thank you! I’ll get back to the opacity issue in a few days and post if I can’t get it working.