Altair support - Layer charts dont appear to work in streamlit
See original GitHub issueSummary
Altair appears to work just fine inside streamlit, but I have problems getting layer charts to work. Note - Concat (vert/horizontal) of altair charts works fine, but doing something like
(chart1 + chart2).resolve_scale(y='independent')
results in everything going blank and no chart canvas displayed
Steps to reproduce
What are the steps we should take to reproduce the bug:
- Build 2 altair charts inside the same streamlit script, ideally with a shared x-axis like time/date (so it makes sense to crate a compound chart)
- try to layer them using
(chart1 + chart2).resolve_scale(y='independent')
Expected behavior:
The layer chart should display with different y-axes
Actual behavior:
Nothing displays - the chart fades as if to reload but everything goes blank
Is this a regression?
this works elsewhere, e.g. in jupyterlab
Debug info
- Streamlit version: 0.60.0
- Python version: Python 3.7.4
- Using Conda
- OS version: Mac OS X Catalina
- Browser version: Brave, Version 1.10.97 Chromium: 83.0.4103.116
Additional information
If needed, add any other context about the problem here. For example, did this bug come from https://discuss.streamlit.io or another site? Link the original source here!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
st.altair_chart - Streamlit Docs
You can do this by creating layered charts, which let you overlay two different charts on top of each other. The idea is...
Read more >Display Troubleshooting — Altair 4.2.0 documentation
If you are expecting a chart output and see nothing at all, it means that the Javascript rendering libraries are not being invoked....
Read more >Streamlit `altair_chart` chart not interactive - Stack Overflow
Basically, you have to explicitly layer the markings and call on .interactive() to make the axis interactive: base = alt.Chart(df).encode( ...
Read more >Introduction to Streamlit and Streamlit Components - Auth0
Don't take my word for it that Streamlit is extremely popular and worth taking a serious look at. Here's a chart I found...
Read more >Data Science Apps Using Streamlit - GeeksforGeeks
which allows us to visualize a large variety of charts and plots but these libraries do not offer any functionalities to deploy them...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @niviksha, thanks for the issue. It looks like Streamlit magics does not detect the output of
resolve_scale
as an Altair object, but you can display the Altair layer throughst.altair_chart
as a workaround.Code sample :
Are there any updates on this?
I am also facing the same concat-within-concat issue producing blank charts. This is the javascript console error: