I am trying to plot an interactive financial chart, but it doesn’t turn dynamic when I use st.altair_chart
Here’s the code:
base = alt.Chart(df).encode(
alt.X('Date:T', axis=alt.Axis(labelAngle=-45)),
color=alt.condition("datum.Open <= datum.Close",
alt.value("#06982d"), alt.value("#ae1325"))
)
rule = base.mark_rule().encode(alt.Y('Low:Q', title='Price',
scale=alt.Scale(zero=False)), alt.Y2('High:Q'))
bar = base.mark_bar().encode(alt.Y('Open:Q'), alt.Y2('Close:Q'))
st.altair_chart(rule + bar, use_container_width=True)
Here is the output plot: