Skip to content

Streamlit embedded app for Altair has tooltip but not the code #1091

@andfanilo

Description

@andfanilo

From the forums we found out a discreapancy between the Streamlit embedded app for Altair chart and the relevant Altair code.

The code reads :

c = alt.Chart(df).mark_circle().encode(x='a', y='b', size='c', color='c')

so there is no tooltip, but in the embedded app there is a tooltip appearing.

so I guess the correct code should read :

c = alt.Chart(df).mark_circle().encode(x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])

if we don't want to modify the embedded app.

Link to doc page in question (if any):

All the links that point to the same Streamlit embedded app :

What you think the docs should say:

For Altair :

c = alt.Chart(df).mark_circle().encode(x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])

For vega-lite :

st.vega_lite_chart(df, {
    "mark": {"type": "circle", "tooltip": True},
    'encoding': {
        'x': {'field': 'a', 'type': 'quantitative'},
        'y': {'field': 'b', 'type': 'quantitative'},
        'size': {'field': 'c', 'type': 'quantitative'},
        'color': {'field': 'c', 'type': 'quantitative'}
    },
})

Also

So I could find charts.vega_lite_chart.py source file for a Streamlit vega-lite but there's no tooltip so I guess that's not the one which generated the embedded app. Could not find charts.altair_chart.py nor text.write4.py so I'm not sure which source file generated the app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:docsRequests for changes to docs (will be rerouted to docs repo)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions