Pre-1.16, Altair charts would not have tooltips unless they were explicitly defined. Now, tooltips are automatically-generated even if they are not defined. Setting theme=None does NOT revert this behavior. Setting tooltip=[] or tooltip=alt.Value(None) causes the chart to have a tooltip that simply reads “true”.
Steps to reproduce
Just make any chart and don’t specify tooltips. They’ll show up, even if you don’t want them. Even if you explicitly define them as blank as described above, you’ll still get a little box popping up saying “true”.
Expected behavior:
Several options, not mutually exclusive:
The tooltip behavior could revert when setting theme=None
The tooltip behavior could be reverted by a separate keyword option: e.g., autoTooltips=False
Setting tooltip=[] or tooltip=alt.Value(None) could appropriately leave the chart with NO tooltips, rather than the weird phantom “true”.
Small update: I have rolled back my cloud deployment of Streamlit to v1.15, and will leave it there until/unless I find a different way to resolve this issue.
Some graphs should not have tooltips. Forcing tooltips, even in inappropriate situations, is a major loss of functionality.
Got a related prob with Plotly and st.plotly_chart since 1.16.
With the introduction of 1.16 Streamlit uses a new theme. Okay, I can skip this theme via theme=None.
But then I do not get the same Plotly charts as before in version 1.14.
Such an adaption is not cool as it is not backwards compatible or at least in an easy way.
Hi @dirk ,
sorry to hear that the plotly charts are not showing up properly in version 1.14 and 1.16, especially when you set the theme=None.
When we were working on this, we definitely wanted to keep it backwards compatible. If you wish to turn off the streamlit theme for all plots,
you can use this:
import plotly.io as pio
pio.templates.default = "none"
As for the actual plots, can you possibly give me the code to reproduce the problem that you’re having. I would love to figure what’s going on and attempt to fix it on our side!
sorry to hear that the tooltips are showing up no matter what. Can you show me some code so that I can reproduce it and then hopefully apply a fix asap?
Hi Will, I’m still seeing this issue in streamlit 1.23.1. A simple example
import altair as alt
import pandas as pd
import streamlit as st
data = pd.DataFrame([[1, 1], [2, 2], [3, 3]], columns=["x", "y"])
# size=500 to make it easier to hover on the dot, the issue appears regardless
chart = alt.Chart(data).mark_circle(size=500).encode(x="x", y="y")
st.altair_chart(chart, use_container_width=True, theme=None)
In my case, I have a boxplot in altair where I am also generating custom text based on the data: the boxplot generates its default tooltips and the text as well.
And setting tooltip=alt.value(None) either for each of the individual, or both or the combined plot does not hide the entire or parts of the tooltip.
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.