jfiel5 commited on
Commit
920bede
·
verified ·
1 Parent(s): dc2c25d

with strip chart (#27)

Browse files

- with strip chart (504832e50ddbc52e6fb70b916a0efee6f5fa9ab6)

Files changed (1) hide show
  1. app.py +31 -9
app.py CHANGED
@@ -113,18 +113,40 @@ bar_chart = (
113
  # )
114
  # .properties(width=1000, height=800)
115
  # )
116
- hist = (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  alt.Chart(df_small)
118
- .mark_bar(opacity=0.7)
119
  .encode(
120
- x=alt.X("YTD Gross:Q", bin=True, title="YTD Gross (binned)"),
121
- y=alt.Y("count()", title="Count"),
122
  color=alt.value("#4C78A8"),
123
- tooltip=[alt.Tooltip("YTD Gross:Q",title="Range"),alt.Tooltip("count():Q",title="Count")]
 
 
 
 
 
 
 
124
  )
125
- .transform_filter(select_bar)
126
- .properties(width=400, height=300)
 
 
127
  )
128
-
129
- dashboard = bar_chart & hist
130
  dashboard
 
113
  # )
114
  # .properties(width=1000, height=800)
115
  # )
116
+ # hist = (
117
+ # alt.Chart(df_small)
118
+ # .mark_bar(opacity=0.7)
119
+ # .encode(
120
+ # x=alt.X("YTD Gross:Q", bin=True, title="YTD Gross (binned)"),
121
+ # y=alt.Y("count()", title="Count"),
122
+ # color=alt.value("#4C78A8"),
123
+ # tooltip=[alt.Tooltip("YTD Gross:Q",title="Range"),alt.Tooltip("count():Q",title="Count")]
124
+ # )
125
+ # .transform_filter(select_bar)
126
+ # .properties(width=400, height=300)
127
+ # )
128
+
129
+
130
+ strip = (
131
  alt.Chart(df_small)
132
+ .mark_circle(size=60, opacity=0.6)
133
  .encode(
134
+ x=alt.X("YTD Gross:Q", title="YTD Gross"),
135
+ y=alt.Y("Agency:N", title=""),
136
  color=alt.value("#4C78A8"),
137
+ tooltip=[
138
+ alt.Tooltip("Agency:N"),
139
+ alt.Tooltip("YTD Gross:Q", format="$,.0f")
140
+ ]
141
+ )
142
+ .transform_filter(select_bar)
143
+ .transform_calculate(
144
+ jitter="0.4 * (random() - 0.5)"
145
  )
146
+ .encode(
147
+ y=alt.Y("jitter:Q", title="", axis=None)
148
+ )
149
+ .properties(width=400, height=200)
150
  )
151
+ dashboard = bar_chart & strip
 
152
  dashboard