[Python] Altair scrollable chart

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to plot data for each day. Depending on the selection of the data it can be a few days, or multiple months. In both cases i want the same scale (1 bar per day)

    I can plot the data per day with no problem. The chart is also scrollable, but if i have selected multiple month, it still only shows 30 days. If i scroll left/right, there is no data. What am i missing?

    timeunit='date'
    a = alt.Chart(data).mark_bar(opacity=0.6).encode(
    x=alt.X('date(Gemeldet_Am):T',
    timeUnit=timeunit,
    axis=alt.Axis(title='Zeitfenster', grid=False)),
    y=alt.Y('count(ABC):Q',
    axis=alt.Axis(title='Number of calls',grid=True)),color='mean(Sentiment):Q',
    tooltip=[alt.Tooltip('count(ABC):Q'),
    alt.Tooltip('mean(Sentiment):Q',title='Sentiment')]).interactive()

    b = alt.Chart(data).mark_line(color='orange', interpolate='monotone').encode(
    x=alt.X('date(Gemeldet_Am):T',
    timeUnit=timeunit),
    y='mean(Sentiment):Q').interactive()

    Continue reading...

Compartilhe esta Página