mahnbonnie commited on
Commit
5931b60
·
verified ·
1 Parent(s): 75deeca

Initial commit

Browse files
Files changed (5) hide show
  1. app.py +63 -0
  2. pyvenv.cfg +8 -0
  3. requirements.txt +3 -0
  4. stocks_toy.csv +5 -0
  5. style.css +53 -0
app.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plost
4
+
5
+ st.set_page_config(layout='wide', initial_sidebar_state='expanded')
6
+
7
+ with open('style.css') as f:
8
+ st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
9
+
10
+ st.sidebar.header('Analysis Dashboard')
11
+
12
+ st.sidebar.subheader('Heat map parameter')
13
+ time_hist_color = st.sidebar.selectbox('Color by', ('temp_min', 'temp_max'))
14
+
15
+ st.sidebar.subheader('Donut chart parameter')
16
+ donut_theta = st.sidebar.selectbox('Select data', ('q2', 'q3'))
17
+
18
+ st.sidebar.subheader('Line chart parameters')
19
+ plot_data = st.sidebar.multiselect('Select data', ['temp_min', 'temp_max'], ['temp_min', 'temp_max'])
20
+ plot_height = st.sidebar.slider('Specify plot height', 200, 500, 250)
21
+
22
+ st.sidebar.markdown('''
23
+ ---
24
+ Created with ❤️ by [Mahn Bonnie](https://github.com/mahn-bonnie).
25
+ ''')
26
+
27
+
28
+ # Row A
29
+ st.markdown('### Metrics')
30
+ col1, col2, col3 = st.columns(3)
31
+ col1.metric("Temperature", "70 °F", "1.2 °F")
32
+ col2.metric("Wind", "9 mph", "-8%")
33
+ col3.metric("Humidity", "86%", "4%")
34
+
35
+ # Row B
36
+ seattle_weather = pd.read_csv('https://raw.githubusercontent.com/tvst/plost/master/data/seattle-weather.csv', parse_dates=['date'])
37
+ stocks = pd.read_csv('https://raw.githubusercontent.com/mahn-bonnie/dashboard-web-app/refs/heads/master/stocks_toy.csv')
38
+
39
+ c1, c2 = st.columns((7,3))
40
+ with c1:
41
+ st.markdown('### Heatmap')
42
+ plost.time_hist(
43
+ data=seattle_weather,
44
+ date='date',
45
+ x_unit='week',
46
+ y_unit='day',
47
+ color=time_hist_color,
48
+ aggregate='median',
49
+ legend=None,
50
+ height=345,
51
+ use_container_width=True)
52
+ with c2:
53
+ st.markdown('### Donut chart')
54
+ plost.donut_chart(
55
+ data=stocks,
56
+ theta=donut_theta,
57
+ color='company',
58
+ legend='bottom',
59
+ use_container_width=True)
60
+
61
+ # Row C
62
+ st.markdown('### Line chart')
63
+ st.line_chart(seattle_weather, x = 'date', y = plot_data, height = plot_height)
pyvenv.cfg ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ home = /usr/bin
2
+ implementation = CPython
3
+ version_info = 3.11.2.final.0
4
+ virtualenv = 20.17.1+ds
5
+ include-system-site-packages = false
6
+ base-prefix = /usr
7
+ base-exec-prefix = /usr
8
+ base-executable = /usr/bin/python3
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ plost
stocks_toy.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ company,q2,q3
2
+ Google,4,2
3
+ Facebook,6,5
4
+ Microsoft,8,2
5
+ Amazon,2,6
style.css ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Logo */
2
+ /* Adapted from Zachary Blackwood */
3
+ [data-testid="stSidebar"] {
4
+ background-image: url(https://streamlit.io/images/brand/streamlit-logo-secondary-colormark-darktext.png);
5
+ background-size: 200px;
6
+ background-repeat: no-repeat;
7
+ background-position: 4px 20px;
8
+ }
9
+
10
+
11
+ /* Card */
12
+ /* Adapted from https://startbootstrap.com/theme/sb-admin-2 */
13
+ div.css-1r6slb0.e1tzin5v2 {
14
+ background-color: #FFFFFF;
15
+ border: 1px solid #CCCCCC;
16
+ padding: 5% 5% 5% 10%;
17
+ border-radius: 5px;
18
+
19
+ border-left: 0.5rem solid #9AD8E1 !important;
20
+ box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
21
+
22
+ }
23
+
24
+ label.css-mkogse.e16fv1kl2 {
25
+ color: #36b9cc !important;
26
+ font-weight: 700 !important;
27
+ text-transform: uppercase !important;
28
+ }
29
+
30
+
31
+ /* Move block container higher */
32
+ div.block-container.css-18e3th9.egzxvld2 {
33
+ margin-top: -5em;
34
+ }
35
+
36
+
37
+ /* Hide hamburger menu and footer */
38
+ div.css-r698ls.e8zbici2 {
39
+ display: none;
40
+ }
41
+
42
+ footer.css-ipbk5a.egzxvld4 {
43
+ display: none;
44
+ }
45
+
46
+ footer.css-12gp8ed.eknhn3m4 {
47
+ display: none;
48
+ }
49
+
50
+ div.vg-tooltip-element {
51
+ display: none;
52
+ }
53
+