From abc09979b7200200ca1d752ab3ce7e545a4f5d08 Mon Sep 17 00:00:00 2001
From: Yo Akiyama
Date: Sat, 11 May 2024 17:55:03 -0400
Subject: [PATCH] wait for plotly to load (wait a long time to test)
---
src/routes/+page.svelte | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index b5010e7..98d420e 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -95,8 +95,14 @@
import { onMount } from 'svelte';
onMount(() => {
- Plotly.newPlot("commutePlot", [...plotCommuteData, commuteRegression], commuteLayout);
- Plotly.newPlot("salaryPlot", [...plotRentData, salaryRegression], salaryLayout);
+ setTimeout(() =>{
+ if (typeof Plotly !== 'undefined') {
+ Plotly.newPlot("commutePlot", [...plotCommuteData, commuteRegression], commuteLayout);
+ Plotly.newPlot("salaryPlot", [...plotRentData, salaryRegression], salaryLayout);
+ } else {
+ console.error("plotly is still not defined after waiting");
+ }
+ }, 1000);
});
@@ -112,18 +118,9 @@
While many resort to long daily commutes, studies have also found that increased commute times are associated with reduced work
and life satisfaction and decreased physical health4.
+
The trade-off between rent, commute time, and salary
But just how large is the trade-off between rent and commute time? Our analyses find that in the Boston area, a $100 increase in rent per bedroom is about equivalent to a 1 minute and 45 second decrease in commute time.
-
- Quantitatively exploring the affordability vs commute time trade-off
-
-
- But just how large is the trade-off between rent and commute time? Our analyses find that in the Boston area,
- a $100 increase in rent per bedroom is about equivalent to a 1 minute and 45 second decrease in commute time.
- We also find complementary evidence that neighborhoods with high rent prices tend to have more businesses and job opportunities
- (normalized by population) and offer higher salaries. The following plot shows the average salary for workers in a given neighborhood
- regressed against the average 1 bedroom apartment rent (with data for both Boston and Cambridge area neighborhoods).
-