External link in Altair Chart does ot work when displayed by Streamlit

Hi,
I’ve made a scattered chart using altair. It contains links to external website. When you click a dot on the link you are redirected.
This works perfectly in Jupyter Notebook, but when it’s inside Streamlit, I have an error: Connection Refused.

Below I paste a part of my code responsible for chart display.

import pandas as pd
import altair as alt

#Analyzed data is here:
URL='https://dl.dropboxusercontent.com/s/blk95gc1bf8errv/Car_Prices_Poland_BS4_1_0.csv'

tabela = pd.read_csv(URL)
tabela['calymodel'] = tabela['mark'] + ' ' + tabela['model']
calymodelunique = tabela['calymodel'].unique()
domyslny_model = calymodelunique.tolist().index('volkswagen passat')



auto = 'volkswagen passat'
auto_wiersze = tabela[tabela['calymodel']==auto]
marka_wybrana = auto.split()[0]
model_wybrany = auto.split()[1]


quant_cen = auto_wiersze['price'].quantile(q=0.99)
quant_mil = auto_wiersze['mileage'].quantile(q=0.99)

scattered = alt.Chart(auto_wiersze).mark_point().encode(
    x=alt.X('price',scale=alt.Scale(domain=(0,quant_cen),clamp=True), title='Cena [zł]'),
    y=alt.Y('mileage',scale=alt.Scale(domain=(0,quant_mil),clamp=True), title='Przebieg [km]'),
    color=alt.Color('year', scale=alt.Scale(scheme='tableau10'),bin=alt.Bin(maxbins=6),legend=alt.Legend(title="Przedziały roczników")),
    tooltip=[alt.Tooltip('year',title='Rocznik'),
            alt.Tooltip('mileage',title='Przebieg'),
            alt.Tooltip('price',title='Cena'),
            alt.Tooltip('link',title='Link')],
     href='link:N', # Tu jest definiowany link do podłączenia
                       
).properties(title="Porównanie ceny w zależności od rocznika i przebiegu",     
    height=600)

scattered

You can also see it in my app - as first chart:
https://share.streamlit.io/napierajpl/streamlit/bs4/streamlit1.py

When you try to follow the link on the chart - your connection is refused.

Do you have any ideas what could happen?

A bit too late but I ran your code (locally) with Streamlit v1.12.2 and the links work.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.