Umar4321 commited on
Commit
e4fce96
·
verified ·
1 Parent(s): f19d884

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -21
app.py CHANGED
@@ -6,7 +6,6 @@ from io import BytesIO
6
  # Page configuration
7
  st.set_page_config(page_title="Research Gantt Chart", layout="wide")
8
 
9
- # Title and description
10
  st.title("📊 Research Proposal Gantt Chart")
11
  st.markdown("""
12
  This Gantt chart outlines the 10-month timeline for your research project:
@@ -39,7 +38,6 @@ fig = px.timeline(
39
  title="Gantt Chart: ASME Nozzle Reinforcement Study",
40
  )
41
 
42
- # Customize layout
43
  fig.update_layout(
44
  xaxis_title="Month",
45
  yaxis_title="Research Phase",
@@ -48,32 +46,22 @@ fig.update_layout(
48
  showlegend=False,
49
  margin=dict(l=40, r=40, t=80, b=40),
50
  height=650,
51
- xaxis=dict(
52
- tickmode="linear",
53
- tick0=1,
54
- dtick=1,
55
- range=[0.5, 11],
56
- title_font=dict(size=16),
57
- ),
58
- yaxis=dict(
59
- title_font=dict(size=16),
60
- )
61
  )
62
 
63
  # Display chart
64
  st.plotly_chart(fig, use_container_width=True)
65
 
66
- # Export chart as PNG
67
- st.markdown("### 📥 Export Chart for Presentation")
68
- buffer = BytesIO()
69
- fig.write_image(buffer, format="png", width=1600, height=900)
70
  st.download_button(
71
- label="Download High-Resolution PNG",
72
- data=buffer.getvalue(),
73
- file_name="ASME_Research_Gantt_Chart.png",
74
- mime="image/png"
75
  )
76
 
77
- # Optional footer
78
  st.markdown("---")
79
  st.caption("Designed by Muhammad | Powered by Streamlit & Plotly")
 
6
  # Page configuration
7
  st.set_page_config(page_title="Research Gantt Chart", layout="wide")
8
 
 
9
  st.title("📊 Research Proposal Gantt Chart")
10
  st.markdown("""
11
  This Gantt chart outlines the 10-month timeline for your research project:
 
38
  title="Gantt Chart: ASME Nozzle Reinforcement Study",
39
  )
40
 
 
41
  fig.update_layout(
42
  xaxis_title="Month",
43
  yaxis_title="Research Phase",
 
46
  showlegend=False,
47
  margin=dict(l=40, r=40, t=80, b=40),
48
  height=650,
49
+ xaxis=dict(tickmode="linear", tick0=1, dtick=1, range=[0.5, 11]),
 
 
 
 
 
 
 
 
 
50
  )
51
 
52
  # Display chart
53
  st.plotly_chart(fig, use_container_width=True)
54
 
55
+ # Export chart as HTML
56
+ st.markdown("### 📥 Download Chart as HTML")
57
+ html_buffer = BytesIO()
58
+ html_buffer.write(fig.to_html(include_plotlyjs='cdn').encode())
59
  st.download_button(
60
+ label="Download Interactive Chart (HTML)",
61
+ data=html_buffer.getvalue(),
62
+ file_name="ASME_Research_Gantt_Chart.html",
63
+ mime="text/html"
64
  )
65
 
 
66
  st.markdown("---")
67
  st.caption("Designed by Muhammad | Powered by Streamlit & Plotly")