Compare View
Commits (2)
Showing
2 changed files
Show diff stats
flaskr/static/js/plots/emissions-equidistant-map.js
1 | // jQuery-free | 1 | // jQuery-free |
2 | -function draw_emissions_equidistant_map(containerSelector, worldDataUrl, countriesDataUrl, emissionsDataUrl) { | 2 | +function draw_emissions_equidistant_map(containerSelector, worldDataUrl, emissionsDataUrl) { |
3 | let margin = {top: 48, right: 88, bottom: 68, left: 98}, | 3 | let margin = {top: 48, right: 88, bottom: 68, left: 98}, |
4 | width = 960 - margin.left - margin.right, | 4 | width = 960 - margin.left - margin.right, |
5 | height = 540 - margin.top - margin.bottom; | 5 | height = 540 - margin.top - margin.bottom; |
@@ -362,6 +362,7 @@ function draw_emissions_equidistant_map(containerSelector, worldDataUrl, countri | @@ -362,6 +362,7 @@ function draw_emissions_equidistant_map(containerSelector, worldDataUrl, countri | ||
362 | 362 | ||
363 | 363 | ||
364 | document.addEventListener("DOMContentLoaded", () => { | 364 | document.addEventListener("DOMContentLoaded", () => { |
365 | + console.info("[Emissions Equidistant Map] Starting…"); | ||
365 | width = document.querySelector(containerSelector).parentElement.offsetWidth; | 366 | width = document.querySelector(containerSelector).parentElement.offsetWidth; |
366 | width = width - margin.left - margin.right; | 367 | width = width - margin.left - margin.right; |
367 | svg = d3.select(containerSelector) | 368 | svg = d3.select(containerSelector) |
@@ -373,12 +374,14 @@ function draw_emissions_equidistant_map(containerSelector, worldDataUrl, countri | @@ -373,12 +374,14 @@ function draw_emissions_equidistant_map(containerSelector, worldDataUrl, countri | ||
373 | d3.csv(emissionsDataUrl), | 374 | d3.csv(emissionsDataUrl), |
374 | d3.json(worldDataUrl), | 375 | d3.json(worldDataUrl), |
375 | ]).then((allTheData) => { | 376 | ]).then((allTheData) => { |
377 | + console.info("[Emissions Equidistant Map] Generating…"); | ||
376 | [emissionsData, worldData] = allTheData; | 378 | [emissionsData, worldData] = allTheData; |
377 | crunchEmissionsData(); | 379 | crunchEmissionsData(); |
378 | recenterOnLatLon( | 380 | recenterOnLatLon( |
379 | parseFloat(emissionsData[0].latitude), | 381 | parseFloat(emissionsData[0].latitude), |
380 | parseFloat(emissionsData[0].longitude) | 382 | parseFloat(emissionsData[0].longitude) |
381 | ); | 383 | ); |
384 | + console.info("[Emissions Equidistant Map] Done.-"); | ||
382 | }); | 385 | }); |
383 | 386 | ||
384 | d3.select(containerSelector+" svg").on("mousedown", function(event) { | 387 | d3.select(containerSelector+" svg").on("mousedown", function(event) { |
flaskr/templates/estimation.html
@@ -262,30 +262,33 @@ | @@ -262,30 +262,33 @@ | ||
262 | 262 | ||
263 | <script type="text/javascript"> | 263 | <script type="text/javascript"> |
264 | 264 | ||
265 | -const plots_config = { | 265 | +var plots_config = { |
266 | 'cities_count': {{ estimation_output.cities | length }} | 266 | 'cities_count': {{ estimation_output.cities | length }} |
267 | }; | 267 | }; |
268 | 268 | ||
269 | {% if not estimation.is_many_to_many() %} | 269 | {% if not estimation.is_many_to_many() %} |
270 | +/** | ||
270 | draw_emissions_per_distance( | 271 | draw_emissions_per_distance( |
271 | "#emissions_per_distance_histogram", | 272 | "#emissions_per_distance_histogram", |
272 | "/estimation/{{ estimation.public_id }}.csv" | 273 | "/estimation/{{ estimation.public_id }}.csv" |
273 | ); | 274 | ); |
275 | +**/ | ||
274 | draw_sorted_emissions_inequality( | 276 | draw_sorted_emissions_inequality( |
275 | "#sorted_emissions_inequality", | 277 | "#sorted_emissions_inequality", |
276 | "/estimation/{{ estimation.public_id }}.csv" | 278 | "/estimation/{{ estimation.public_id }}.csv" |
277 | ); | 279 | ); |
278 | {% endif %} | 280 | {% endif %} |
279 | 281 | ||
280 | - | 282 | +/** |
281 | draw_emissions_equidistant_map( | 283 | draw_emissions_equidistant_map( |
282 | "#d3viz_emissions_equidistant_map", | 284 | "#d3viz_emissions_equidistant_map", |
283 | {#"/static/public/data/worldmap.geo.json",#} | 285 | {#"/static/public/data/worldmap.geo.json",#} |
284 | "/static/public/data/world-earth.geojson", | 286 | "/static/public/data/world-earth.geojson", |
285 | - "/static/public/data/countries-coordinates.csv", | 287 | + {#"/static/public/data/countries-coordinates.csv",#} |
286 | "/estimation/{{ estimation.public_id }}.csv" | 288 | "/estimation/{{ estimation.public_id }}.csv" |
287 | {#"/estimation/{{ estimation.public_id }}/trips_to_destination_0.csv"#} | 289 | {#"/estimation/{{ estimation.public_id }}/trips_to_destination_0.csv"#} |
288 | ); | 290 | ); |
291 | +**/ | ||
289 | 292 | ||
290 | draw_travel_legs_worldmap( | 293 | draw_travel_legs_worldmap( |
291 | "#d3viz_travels", | 294 | "#d3viz_travels", |
@@ -372,6 +375,7 @@ jQuery(document).ready(function($){ | @@ -372,6 +375,7 @@ jQuery(document).ready(function($){ | ||
372 | 375 | ||
373 | 376 | ||
374 | jQuery(document).ready(function($){ | 377 | jQuery(document).ready(function($){ |
378 | + console.info("[Footprint Lollipop] Starting…"); | ||
375 | var vizid = "#cities_footprints_d3viz_lollipop"; | 379 | var vizid = "#cities_footprints_d3viz_lollipop"; |
376 | var csvUrl = "/estimation/{{ estimation.public_id }}.csv"; | 380 | var csvUrl = "/estimation/{{ estimation.public_id }}.csv"; |
377 | var y_key = 'city'; | 381 | var y_key = 'city'; |
@@ -399,6 +403,7 @@ jQuery(document).ready(function($){ | @@ -399,6 +403,7 @@ jQuery(document).ready(function($){ | ||
399 | "translate(" + margin.left + "," + margin.top + ")"); | 403 | "translate(" + margin.left + "," + margin.top + ")"); |
400 | 404 | ||
401 | d3.csv(csvUrl).then(function (data) { | 405 | d3.csv(csvUrl).then(function (data) { |
406 | + console.info("[Footprint Lollipop] Generating…"); | ||
402 | // Extrema | 407 | // Extrema |
403 | var data_x_max = d3.max(data, function (d) { | 408 | var data_x_max = d3.max(data, function (d) { |
404 | return parseFloat(d[x_key]); | 409 | return parseFloat(d[x_key]); |
@@ -606,7 +611,7 @@ jQuery(document).ready(function($){ | @@ -606,7 +611,7 @@ jQuery(document).ready(function($){ | ||
606 | }); | 611 | }); |
607 | 612 | ||
608 | $('#cities_footprints_spinner').hide(); | 613 | $('#cities_footprints_spinner').hide(); |
609 | - | 614 | + console.info("[Footprint Lollipop] Done."); |
610 | }); | 615 | }); |
611 | 616 | ||
612 | }); | 617 | }); |