Spaces:
Sleeping
Sleeping
Update app.py
#33
by jfiel5 - opened
app.py
CHANGED
|
@@ -84,13 +84,29 @@ select_bar = alt.selection_point(
|
|
| 84 |
clear="true"
|
| 85 |
)
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
bar_chart = (
|
| 89 |
alt.Chart(df_small)
|
| 90 |
.mark_bar()
|
| 91 |
.encode(
|
| 92 |
y=alt.Y("Agency:N", sort="-x"),
|
| 93 |
-
x=alt.X("
|
| 94 |
tooltip=[
|
| 95 |
"Agency:N",
|
| 96 |
alt.Tooltip("mean(YTD Gross):Q", title="Avg YTD Gross", format="$,.0f")
|
|
@@ -102,6 +118,22 @@ bar_chart = (
|
|
| 102 |
)
|
| 103 |
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
# box = (
|
| 106 |
# alt.Chart(df_small)
|
| 107 |
# .mark_boxplot(size=40)
|
|
|
|
| 84 |
clear="true"
|
| 85 |
)
|
| 86 |
|
| 87 |
+
#summing the barchart but the human services and transit departments are so large you cannot click on the other agencies
|
| 88 |
+
# bar_chart = (
|
| 89 |
+
# alt.Chart(df_small)
|
| 90 |
+
# .mark_bar()
|
| 91 |
+
# .encode(
|
| 92 |
+
# y=alt.Y("Agency:N", sort="-x"),
|
| 93 |
+
# x=alt.X("sum(YTD Gross):Q", title="Total Personale Expense"), # <-- take the mean
|
| 94 |
+
# tooltip=[
|
| 95 |
+
# "Agency:N",
|
| 96 |
+
# alt.Tooltip("mean(YTD Gross):Q", title="Avg YTD Gross", format="$,.0f")
|
| 97 |
+
# ],
|
| 98 |
+
# color=alt.condition(select_bar, alt.value("#4C78A8"), alt.value("#CCCCCC"))
|
| 99 |
+
# )
|
| 100 |
+
# .add_params(select_bar)
|
| 101 |
+
# .properties(width=500, height=800)
|
| 102 |
+
# )
|
| 103 |
|
| 104 |
bar_chart = (
|
| 105 |
alt.Chart(df_small)
|
| 106 |
.mark_bar()
|
| 107 |
.encode(
|
| 108 |
y=alt.Y("Agency:N", sort="-x"),
|
| 109 |
+
x=alt.X("mean(YTD Gross):Q", title="Average Personale Expense"), # <-- take the mean
|
| 110 |
tooltip=[
|
| 111 |
"Agency:N",
|
| 112 |
alt.Tooltip("mean(YTD Gross):Q", title="Avg YTD Gross", format="$,.0f")
|
|
|
|
| 118 |
)
|
| 119 |
|
| 120 |
|
| 121 |
+
bar_chart = (
|
| 122 |
+
alt.Chart(df_small)
|
| 123 |
+
.mark_bar()
|
| 124 |
+
.encode(
|
| 125 |
+
y=alt.Y("Agency:N", sort="-x"),
|
| 126 |
+
x=alt.X("sum(YTD Gross):Q", title="Total Personale Expense"), # <-- take the mean
|
| 127 |
+
tooltip=[
|
| 128 |
+
"Agency:N",
|
| 129 |
+
alt.Tooltip("mean(YTD Gross):Q", title="Avg YTD Gross", format="$,.0f")
|
| 130 |
+
],
|
| 131 |
+
color=alt.condition(select_bar, alt.value("#4C78A8"), alt.value("#CCCCCC"))
|
| 132 |
+
)
|
| 133 |
+
.add_params(select_bar)
|
| 134 |
+
.properties(width=500, height=800)
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
# box = (
|
| 138 |
# alt.Chart(df_small)
|
| 139 |
# .mark_boxplot(size=40)
|