However, I’m not sure where to start - I’m unable to write iframes with st.write, even with unsafe_allow_html=True [1]. More generally, I don’t see any way to write arbitrary HTML/javascript. I believe the streamlit way of doing it would be to add a function st.hiplot_render, but it seems quite involved to have to modify the framework to render a third party library and wanted to get advises on how to move forward.
Thank you!
[1] Minimal code:
import streamlit as st
import html
page_html = '''<!DOCTYPE html>
<html></html>'''
st.write(f'<iframe style="width: 100%; height: 100vh; border: 0px" srcdoc="{html.escape(page_html)}"></iframe>', unsafe_allow_html=True)
# using st.markdown does the same as the line above
Hey @danthe3rd! I was actually just reading about HiPlot a couple days ago. Looks so awesome. Love the parallel-coordinate charts
Right now the only way to implement support for new visualizations in Streamlit is to actually build it into the standard Streamlit library. So you’d have to implement a new built-in command like st.hiplot(...), write a React component to handle it, and contribute a PR. If this is something you’d like to do, we’d be thrilled to walk you through the steps to get this done.
Looking into the future (i.e. next few months!), we’re currently designing two lighter-weight ways of adding functionality into Streamlit:
We’re considering implementing st.html(the_html), which would let users plop in some custom HTML inside an iframe. We have an early prototype here: https://github.com/streamlit/streamlit/pull/968 . The prototype is missing sandboxing and automatic height calculation, but it’s usable if you’d like to play with it.
We’re also working on a plugin system for Streamlit. This is something we want to release by July this year, but we’ll share design docs and prototype PRs with the community before we settle on the exact design to make sure people’s needs are accounted for.
Unless I have more bandwidth in the coming weeks, I think I’ll wait for st.html function, because adding something to streamlit will require a bit more work, and maintenance
Hey @jml
I’m currently working with the Streamlit team to have a HiPlot component available very soon
You can subscribe yourself to the corresponding HiPlot issue - I’ll let you know when you can try it out
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.