I am trying to create an interactive stacked area plot, where the active selection (the one I click in the legend) is the one visible. However, I would like the active selection to be starting from y=0 instead of just highlighted. Is there a way to do this? Furthermore, would it be possible to select multiple values from the legend instead of just one?
import altair as alt
from vega_datasets import data
source = data.unemployment_across_industries.url
selection = alt.selection_multi(fields=['series'], bind='legend',init=[{'series': 'Agriculture'}])
alt.Chart(source).mark_area().encode(
alt.X('yearmonth(date):T', axis=alt.Axis(domain=False, format='%Y', tickSize=0)),
alt.Y('sum(count):Q', stack="zero"),
alt.Color('series:N'),
opacity=alt.condition(selection, alt.value(1), alt.value(0.1))
).add_selection(
selection
)
