Zoom or dynamic Layout "line_chart" with big numbers

If I have numbers from 12’000 until 12’050 in a Chart I can not really see the differense:


The Chart always starts with 0, can I adjust that to 10’000 or a range around my average number?

Is it possible to add an Attribute for this case, I was not able to find one here:

Hi @weyCC81, welcome to the Streamlit community!

st.line_chart is a quick-start/convenience function for getting started creating plots, and as such, doesn’t have any arguments to it. When you want to customize the chart further, st.line_chart is a wrapper around st.altair_chart, which gives you the full power of the Altair plotting library.

https://altair-viz.github.io/index.html

Best,
Randy

Hi @randyzwitch

Thanks for your reply, I suspected that and got it working with something like:

c = alt.Chart(dataframe).mark_line().encode(x='index', y = alt.Y('Close', scale=alt.Scale(zero=False))).properties(width=800, height=150)
st.altair_chart(c)

(it would however be nice to have this “zero=False” in st.line_chart).

2 Likes

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