A search interface for the Performing Patents Otherwise publication as part of the Politics of Patents case study (part of Copim WP6): this parses data from the archive of RTF files and provides additional data from the European Patent Office OPS API. https://patents.copim.ac.uk
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
2.7KB

  1. {% extends "base.html" %}
  2. {% block content %}
  3. <a href="{{ url_for('main.index') }}" class="h1 text-left"> ⇽ </a>
  4. There are a total of {{ total_number }} patents.
  5. <br><br>
  6. <div class="row">
  7. <div class="col-6 text-center">
  8. {% for i in range(0, year_data|length) %}
  9. {% if i % 2 %}
  10. {{ year_data[i] }}<br>
  11. {% else %}
  12. {{ year_data[i] }}:
  13. {% endif %}
  14. {% endfor %}
  15. </div>
  16. <div class="col-6 text-center">
  17. {% for i in range(0, country_data|length) %}
  18. {% if i % 2 %}
  19. {{ country_data[i] }}<br>
  20. {% else %}
  21. {% if country_data[i].name is defined %}
  22. {{ country_data[i].name }} {{ country_data[i].flag }}:
  23. {% else %}
  24. {{ country_data[i] }}:
  25. {% endif %}
  26. {% endif %}
  27. {% endfor %}
  28. </div>
  29. </div>
  30. <canvas id="chartOfYearFrequency" width="600" height="300"></canvas>
  31. <canvas id="chartOfCountryFrequency" width="600" height="300"></canvas>
  32. <script type="text/javascript">
  33. // retrieve variables passed from Python
  34. var year_labels = {{ year_labels|safe }}
  35. var year_dataset = {{ year_dataset|safe }}
  36. // set up chart
  37. var data = {
  38. labels: year_labels,
  39. datasets: year_dataset,
  40. };
  41. var config = {
  42. type: 'bar',
  43. data: data,
  44. options: {
  45. plugins: {
  46. title: {
  47. display: true,
  48. text: 'number of patent records for each year'
  49. },
  50. },
  51. responsive: true,
  52. scales: {
  53. x: {
  54. title: {
  55. display: true,
  56. text: 'year'
  57. },
  58. stacked: true,
  59. },
  60. y: {
  61. title: {
  62. display: true,
  63. text: 'number of records'
  64. },
  65. stacked: true
  66. }
  67. }
  68. }
  69. };
  70. var yearGraph = new Chart(
  71. document.getElementById('chartOfYearFrequency'),
  72. config
  73. );
  74. </script>
  75. <script type="text/javascript">
  76. // retrieve variables passed from Python
  77. var country_labels = {{ country_labels|safe }}
  78. var country_dataset = {{ country_dataset|safe }}
  79. // set up chart
  80. var data = {
  81. labels: country_labels,
  82. datasets: country_dataset,
  83. };
  84. var config = {
  85. type: 'bar',
  86. data: data,
  87. options: {
  88. plugins: {
  89. title: {
  90. display: true,
  91. text: 'number of patent records from each country'
  92. },
  93. },
  94. responsive: true,
  95. scales: {
  96. x: {
  97. title: {
  98. display: true,
  99. text: 'country'
  100. },
  101. stacked: true,
  102. },
  103. y: {
  104. title: {
  105. display: true,
  106. text: 'number of records'
  107. },
  108. stacked: true
  109. }
  110. }
  111. }
  112. };
  113. var yearGraph = new Chart(
  114. document.getElementById('chartOfCountryFrequency'),
  115. config
  116. );
  117. </script>
  118. {% endblock %}