jfiel5 commited on
Commit
60fc18c
·
verified ·
1 Parent(s): dafe181

adding jacobs dashboard

Browse files
Files changed (1) hide show
  1. app.py +44 -0
app.py CHANGED
@@ -70,3 +70,47 @@ if selected_division:
70
 
71
  st.text('Overall Future Edits: Figure out what to do with positions with 1 employee (if anything), Decide whether to use transportation or corrections data, Re-capitalize agency departments')
72
  st.text('Chart A Future Edits: Order bars by mean YTD Gross, Make all position titles readable, add title')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  st.text('Overall Future Edits: Figure out what to do with positions with 1 employee (if anything), Decide whether to use transportation or corrections data, Re-capitalize agency departments')
72
  st.text('Chart A Future Edits: Order bars by mean YTD Gross, Make all position titles readable, add title')
73
+
74
+
75
+ import altair as alt
76
+ import pandas as pd
77
+
78
+ alt.data_transformers.disable_max_rows()
79
+
80
+
81
+ select_bar = alt.selection_point(
82
+ fields=["agency"],
83
+ on="click",
84
+ clear="true"
85
+ )
86
+
87
+
88
+ bar_chart = (
89
+ alt.Chart(df2)
90
+ .mark_bar()
91
+ .encode(
92
+ y=alt.Y("agency:N", sort="-x"),
93
+ x=alt.X("ytd_gross:Q", title="Total YTD Gross"),
94
+ tooltip=["agency:N", "ytd_gross:Q"],
95
+ color=alt.condition(select_bar, alt.value("#4C78A8"), alt.value("#CCCCCC"))
96
+ )
97
+ .add_params(select_bar)
98
+ .properties(width=500, height=800)
99
+ )
100
+
101
+
102
+ box = (
103
+ alt.Chart(df)
104
+ .mark_boxplot(size=40)
105
+ .encode(
106
+ x=alt.X("agency:N", title=""),
107
+ y=alt.Y("ytd_gross:Q", title="Salary Distribution"),
108
+ color=alt.value("#4C78A8")
109
+ )
110
+ .transform_filter(select_bar) # <--- THIS CONNECTS THE GRAPHS
111
+ .properties(width=120, height=800)
112
+ )
113
+
114
+
115
+ dashboard = bar_chart | box
116
+ dashboard