Procházet zdrojové kódy

adding more data to 'data' page

solr_update
Simon Bowie před 2 roky
rodič
revize
d4f363d5e1
3 změnil soubory, kde provedl 31 přidání a 1 odebrání
  1. +2
    -1
      web/app/data.py
  2. +8
    -0
      web/app/templates/compare.html
  3. +21
    -0
      web/app/templates/data.html

+ 2
- 1
web/app/data.py Zobrazit soubor

@@ -4,7 +4,7 @@
# @author: Simon Bowie <ad7588@coventry.ac.uk>
# @purpose: data route for data
# @acknowledgements:
#
# pycountry module for country data

from flask import Blueprint, render_template, request
import random
@@ -48,6 +48,7 @@ def main_data():
if country is None:
country = pycountry.historic_countries.get(alpha_2=country_data[i])
country_labels.append(country.name)
country_data[i] = country
country_dataset.append(country_dict)

germany = pycountry.countries.get(alpha_2='DE')

+ 8
- 0
web/app/templates/compare.html Zobrazit soubor

@@ -27,6 +27,14 @@
</p>
{% endif %}

{% if result['country'] is defined %}
<p class="mb-2">
Country:
{{ result['country'].name }}
{{ result['country'].flag }}
</p>
{% endif %}

{% if result['original_title'] is defined %}
<p class="mb-2">
Original language title:

+ 21
- 0
web/app/templates/data.html Zobrazit soubor

@@ -8,6 +8,27 @@ There are a total of {{ total_number }} patents.

<br><br>

<div class="row">
<div class="col-6 text-center">
{% for i in range(0, year_data|length) %}
{% if i % 2 %}
{{ year_data[i] }}<br>
{% else %}
{{ year_data[i] }}:
{% endif %}
{% endfor %}
</div>
<div class="col-6 text-center">
{% for i in range(0, country_data|length) %}
{% if i % 2 %}
{{ country_data[i] }}<br>
{% else %}
{{ country_data[i].name }} {{ country_data[i].flag }}:
{% endif %}
{% endfor %}
</div>
</div>

<canvas id="chartOfYearFrequency" width="600" height="300"></canvas>
<canvas id="chartOfCountryFrequency" width="600" height="300"></canvas>


Načítá se…
Zrušit
Uložit