File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -174,6 +174,21 @@ def _get_line_hovertext(column: str) -> str:
174174 )
175175
176176
177+ def _get_axis_unit_for_column (column : str ) -> str :
178+ units = {
179+ "Total Population" : "People" ,
180+ "Total Worked from Home" : "People" ,
181+ "Total With Public Assistance" : "People" ,
182+ "Median Household Income" : "Dollars" ,
183+ "Median Rent" : "Dollars" ,
184+ }
185+
186+ if column not in units :
187+ raise ValueError (f"Unknown variable: { column } " )
188+
189+ return units [column ]
190+
191+
177192def get_line_graph (name : str , col : str ) -> go .Figure :
178193 df = be .get_data_for_name (name )
179194 df ["Year" ] = df ["Year" ].astype (int )
@@ -241,6 +256,7 @@ def get_line_graph(name: str, col: str) -> go.Figure:
241256 ),
242257 yaxis = dict (
243258 tickformat = "," ,
259+ title = _get_axis_unit_for_column (col ),
244260 ),
245261 legend = dict (
246262 orientation = "h" ,
You can’t perform that action at this time.
0 commit comments