Streamlit 1.16 forces unwanted Altair tooltips with no option to disable


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”.

Actual behavior:

As described.

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.

1 Like

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 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!

Hi @Matt_Delventhal ,

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 @willhuang,

yes, I will try to give an example here - have to produce both versions first and that means I have to work with v 1.16 in parallel.


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)

Looks like the problem is in this line in the default theme (not the optional one): streamlit/frontend/src/lib/components/elements/ArrowVegaLiteChart/CustomTheme.tsx at develop · streamlit/streamlit · GitHub

Maybe I am late for the answer, but the easy solution is to explicitly set to None the tooltip in the altair encoding:

chart = alt.Chart(data).mark_circle(size=500).encode(x=“x”, y=“y”,tooltip=alt.value(None))

Are there any updates on this?

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.

Has anyone solved this problem already?