Commit 29a1d1c198d9e7cad24e5c9961651a094fc39526

Authored by Antoine Goutenoir
1 parent e2e42156
Exists in master

Rename columns in the estimation output CSV file.

Fixes {41
flaskr/controllers/main_controller.py
... ... @@ -722,8 +722,10 @@ def consult_estimation(public_id, extension):
722 722 cw = csv.writer(si, quoting=csv.QUOTE_ALL)
723 723 cw.writerow([
724 724 u"city", u"country", u"address",
725   - u"co2 (kg)", u"distance (km)",
726   - u"plane trips", u'train trips',
  725 + u"co2_kg",
  726 + u"distance_km",
  727 + u"plane trips_amount",
  728 + u'train trips_amount',
727 729 ])
728 730  
729 731 results = estimation.get_output_dict()
... ...
flaskr/templates/estimation.html
1 1 {% extends "base.html" %}
2 2  
3 3  
  4 +
4 5 {% block title %}Estimation {{ estimation.public_id }} of your ✈ travel footprint{% endblock %}
5 6  
6 7  
  8 +
7 9 {% block hero %}
8 10 <div class="jumbotron">
9 11 {% if estimation.has_failed() %}
... ... @@ -341,10 +343,10 @@ jQuery(document).ready(function($){
341 343 var vizid = "#cities_footprints_d3viz_lollipop";
342 344 var csvUrl = "/estimation/{{ estimation.public_id }}.csv";
343 345 var y_key = 'city';
344   - var x_key = 'co2 (kg)';
  346 + var x_key = 'co2_kg';
345 347  
346 348 var margin = {top: 40, right: 40, bottom: 150, left: 180},
347   - height = Math.max(300, 100+16*plots_config['cities_count']) - margin.top - margin.bottom;
  349 + height = Math.max(300, 100 + 16*plots_config['cities_count']) - margin.top - margin.bottom;
348 350 var width = Math.max(880, $(vizid).parent().width());
349 351 width = width - margin.left - margin.right;
350 352  
... ... @@ -367,7 +369,9 @@ jQuery(document).ready(function($){
367 369 d3.csv(csvUrl, function (data) {
368 370  
369 371 // Extrema
370   - var data_x_max = d3.max(data, function (d) { return parseFloat(d[x_key]); });
  372 + var data_x_max = d3.max(data, function (d) {
  373 + return parseFloat(d[x_key]);
  374 + });
371 375 var axis_x_max = ceil_value_to_magnitude(data_x_max);
372 376  
373 377 // X axis
... ...