I have done some stock analysis and print this analysis using st.column()
In the output of code Chart Column popover button visible large in height i want to make it small so it don’t affect the column and row structure. and it should be aline with corresponding row
In the given screenshot of my code output you can see chart column popover element going to output of the row bound , how to fix it
here is code part of chart column
# Display the DataFrame table with popover buttons aligned with symbol names
# Add header names
col1 = st.empty()
col2 = st.empty()
col3 = st.empty()
col4 = st.empty()
col5 = st.empty()
col6 = st.empty()
col7 = st.empty()
col8 = st.empty()
col9 = st.empty()
col10 = st.empty()
col11 = st.empty()
col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 = st.columns([14,14,11,21,14,21,21,21,21,7,21])
# Display column names in bold
col1.markdown("**Symbol**")
col2.markdown("**Close**")
col3.markdown("**Zone**")
col4.markdown("**Leg-in Date**")
col5.markdown("""<span title="BC Stand for Base Count , This is number between legin candle and legout candle"> **BC** </span>""", unsafe_allow_html=True)
col6.markdown("**Leg-out Date**")
col7.markdown("**Legout Count**")
col8.markdown("**Proximal Line**")
col9.markdown("**Distal Line**")
col10.markdown("""<span title="TF Stand for Time Frame , This is Chart time for analysing stock to find zone"> **TF** </span>""", unsafe_allow_html=True)
col11.markdown("**Chart**")
for index, row in df.iterrows():
try:
legin_date = pd.to_datetime(row['Leg-in Date'])
legout_date = pd.to_datetime(row['Leg-out Date'])
start_date = (legin_date - pd.Timedelta(days=10)).strftime('%Y-%m-%d')
end_date = datetime.datetime.now().strftime("%Y-%m-%d")
with col1:
st.write(row['Symbol'])
with col2:
st.write(row['Close'])
with col3:
st.write(row['Pattern'])
with col4:
st.write(row['Leg-in Date'])
with col5:
st.write(row['Base Count'])
with col6:
st.write(row['Leg-out Date'])
with col7:
st.write(row['Legout Count'])
with col8:
st.write(row['Proximal Line'])
with col9:
st.write(row['Distal Line'])
with col10:
st.write(row['Time Frame'])
with col11:
with st.popover(f"📊"):
plot_candlestick(stock_data.loc[start_date:end_date], row['Symbol'], start_date, end_date, legin_date, legout_date)
except Exception as e:
st.error(f"Error occurred while processing {row['Symbol']}: {e}")
if __name__ == "__main__":
main()