11 changed files with 364 additions and 196 deletions
@ -0,0 +1,191 @@ |
|||
<!-- population/templates/population/output.html --> |
|||
|
|||
{% extends 'frontend.html' %} |
|||
|
|||
{% block content %} |
|||
|
|||
<script src="https://code.highcharts.com/highcharts.js"></script> |
|||
<script src="https://code.highcharts.com/modules/exporting.js"></script> |
|||
<script src="https://code.highcharts.com/modules/export-data.js"></script> |
|||
<script src="https://code.highcharts.com/modules/accessibility.js"></script> |
|||
<script src="https://code.highcharts.com/modules/series-label.js"></script> |
|||
|
|||
<style> |
|||
td {text-align:right;} |
|||
</style> |
|||
|
|||
|
|||
<h1>CO2-Budget ihrer Kommune</h1> |
|||
|
|||
<br style="clear:both;"> |
|||
<h1>Daten für {{ nameDistrict }}</h1> |
|||
<div class="row"> |
|||
<div class="col-md-6"> |
|||
|
|||
<h2>Angaben zur Kommune</h2> |
|||
<table class="table table-striped table-sm"> |
|||
<tr><th>Name</th><td>{{ nameDistrict }}</sub></td></tr> |
|||
<tr><th>Einwohnerzahl</th><td>{{ populationDistrict }}</sub></td></tr> |
|||
</table> |
|||
|
|||
<p><a class="btn btn-primary" href="/download?id={{gemeindeId}}&year={{zieljahr}}" target="_blank"> |
|||
Download Klimaberechnung</a> |
|||
</p> |
|||
|
|||
|
|||
<h2>Die wichtigen Zahlen</h2> |
|||
<table class="table table-striped"> |
|||
<tr><th>Zieljahr der Klimaneutralität</th><td>{{ zieljahr }}</sub></td></tr> |
|||
<tr><th>Budget Kommune 2016</th><td>{{ budgetKommune2016 }} t</td></tr> |
|||
<tr><th>Verbleibendes Budget nach Zieljahr</th><td>{{ verbleibendesBudget }} t</td></tr> |
|||
<tr><th>THG-Bilanz 2018</th><td>{{ bilanzGES }} t</td></tr> |
|||
<tr><th>Gesamtkosten</th><td>{{ kostenGES }} €</td></tr> |
|||
<tr><th>Anteil der Kommune</th><td>{{ kostenAntKommune }} €</td></tr> |
|||
<tr><th>Gesamtkosten pro Jahr bis Zieljahr</th><td>{{kostenProJahr}} €</td></tr> |
|||
<tr><th>Anteil der Kommune bis Zieljahr</th><td>{{ kostenAnteilKommuneJahr }} €</td></tr> |
|||
<tr><th>Arbeitsplätze gesamt</th><td>{{ arbeitsplGES }}</td></tr> |
|||
<tr><th>kommunale Arbeitsplätze</th><td>{{ arbeitsplAntKommune }}</td></tr> |
|||
</table> |
|||
|
|||
<h2>Download</h2> |
|||
<p><a class="btn btn-primary" href="/download?id={{gemeindeId}}&year={{zieljahr}}" target="_blank">Klimaberechnung</a> (PDF)</p> |
|||
|
|||
</div> |
|||
|
|||
<div class="col-md-6"> |
|||
<h2>CO<sub>2</sub> Emission 2018</h2> |
|||
<figure class="highcharts-figure"> |
|||
<div id="container1"></div> |
|||
Gesamtmenge {{bilanzGES}} t |
|||
</figure> |
|||
|
|||
|
|||
<h3>Reduktionspfad CO<sub>2</sub>2 Emissionen 2016-2036</h3> |
|||
<figure class="highcharts-figure"> |
|||
<div id="container2"></div> |
|||
</figure> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<div class="row"> |
|||
|
|||
|
|||
</div> |
|||
|
|||
|
|||
<script> |
|||
Highcharts.chart('container1', { |
|||
chart: { |
|||
plotBackgroundColor: null, |
|||
plotBorderWidth: null, |
|||
plotShadow: false, |
|||
type: 'pie' |
|||
}, |
|||
title: { |
|||
text: 'CO2-Emission 2018' |
|||
}, |
|||
tooltip: { |
|||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' |
|||
}, |
|||
accessibility: { |
|||
point: { |
|||
valueSuffix: '%' |
|||
} |
|||
}, |
|||
plotOptions: { |
|||
pie: { |
|||
allowPointSelect: true, |
|||
cursor: 'pointer', |
|||
dataLabels: { |
|||
enabled: true, |
|||
format: '<b>{point.name}</b>: {point.percentage:.1f} %' |
|||
} |
|||
} |
|||
}, |
|||
series: [{ |
|||
name: 'Anteile', |
|||
colorByPoint: true, |
|||
data: [{ |
|||
name: 'Energiewirtschaft', |
|||
y: {{ bilanzEWdata }}, |
|||
//sliced: true, |
|||
//selected: true |
|||
}, { |
|||
name: 'Industrie', |
|||
y: {{ bilanzINdata }} |
|||
}, { |
|||
name: 'Gebäude', |
|||
y: {{ bilanzGBdata }} |
|||
}, { |
|||
name: 'Verkehr', |
|||
y: {{ bilanzGBdata }} |
|||
}, { |
|||
name: 'Landwirtschaft', |
|||
y: {{ bilanzLWdata }} |
|||
}, { |
|||
name: 'Sonstige', |
|||
y: {{ bilanzSOdata }} |
|||
}, ] |
|||
}] |
|||
}); |
|||
|
|||
|
|||
Highcharts.chart('container2', { |
|||
chart: { |
|||
type: 'spline' |
|||
}, |
|||
title: { |
|||
text: 'Reduktionspfad der Kommune' |
|||
}, |
|||
subtitle: { |
|||
text: '{{ nameDistrict }}' |
|||
}, |
|||
xAxis: { |
|||
categories: [ |
|||
|
|||
{% for key,val in emissionKommuneData.items %} |
|||
'{{ key }}', |
|||
{% endfor %} |
|||
|
|||
] |
|||
}, |
|||
yAxis: { |
|||
title: { |
|||
text: 'Temperature' |
|||
}, |
|||
labels: { |
|||
formatter: function () { |
|||
return this.value + '°'; |
|||
} |
|||
} |
|||
}, |
|||
tooltip: { |
|||
crosshairs: true, |
|||
shared: true |
|||
}, |
|||
plotOptions: { |
|||
spline: { |
|||
marker: { |
|||
radius: 4, |
|||
lineColor: '#666666', |
|||
lineWidth: 1 |
|||
} |
|||
} |
|||
}, |
|||
series: [{ |
|||
name: 'CO2-Budget', |
|||
marker: { |
|||
symbol: 'square' |
|||
}, |
|||
data: [ |
|||
{% for key,val in emissionKommuneData.items %} |
|||
{{ val }}, |
|||
{% endfor %} |
|||
] |
|||
}] |
|||
}); |
|||
</script> |
|||
|
|||
|
|||
{% endblock content %} |
@ -0,0 +1,69 @@ |
|||
% Author: Henri Menke |
|||
\documentclass[tikz,border=10pt]{article} |
|||
\usepackage{pgfplots} |
|||
\usepackage{pgf-pie} |
|||
|
|||
|
|||
\begin{document} |
|||
|
|||
\section*{Daten für {{ nameDistrict }} } |
|||
|
|||
\subsection*{Angaben zur Kommune} |
|||
|
|||
\begin{tabular}{lr} |
|||
\hline |
|||
Name & {{ nameDistrict }} \\ |
|||
\hline |
|||
Einwohnerzahl & {{ populationDistrict }} \\ |
|||
\hline |
|||
\end{tabular} |
|||
|
|||
|
|||
\subsection*{Die wichtigen Zahlen} |
|||
|
|||
\begin{tabular}{lr} |
|||
\hline |
|||
Zieljahr der Klimaneutralität & {{ zieljahr }} \\ |
|||
Budget Kommune 2016 & {{ budgetKommune2016 }} t \\ |
|||
Verbleibendes Budget nach Zieljahrb & {{ verbleibendesBudget }} t \\ |
|||
THG-Bilanz 2018 & {{ bilanzGES }} t \\ |
|||
Gesamtkosten & {{ kostenGES }} € \\ |
|||
Anteil der Kommune & {{ kostenAntKommune }} € \\ |
|||
Gesamtkosten pro Jahr bis Zieljahr & {{kostenProJahr}} € \\ |
|||
Anteil der Kommune bis Zieljahr & {{ kostenAnteilKommuneJahr }} € \\ |
|||
Arbeitsplätze gesamt & {{ arbeitsplGES }} \\ |
|||
kommunale Arbeitsplätze & {{ arbeitsplAntKommune }} \\ |
|||
\hline |
|||
\end{tabular} |
|||
|
|||
|
|||
\subsection*{Reduktionspfad von {{ nameDistrict }}} |
|||
|
|||
|
|||
\begin{tikzpicture}[scale=1.4, font=\sffamily] |
|||
\begin{axis}[ |
|||
xlabel=Jahr, |
|||
ylabel=Emission in Mio. t CO2, |
|||
/pgf/number format/.cd, |
|||
use comma, |
|||
set thousands separator={} |
|||
] |
|||
\addplot+[smooth,color=red]coordinates { {{ verlauf }} }; |
|||
\end{axis} |
|||
\end{tikzpicture} |
|||
|
|||
|
|||
|
|||
\newpage |
|||
\subsection*{Verteilung der CO2-Emission auf die Sektoren} |
|||
Insgesamt verteilt sich die CO2-Emission von {{ nameDistrict }} von {{ bilanzGES }} auf die folgenden Sektoren: |
|||
|
|||
\begin{tikzpicture}[y=1.2cm, x=1.2cm,font=\sffamily] |
|||
\pie[pos={8,0}, |
|||
color={lime, orange, yellow, lightgray, teal, white}] |
|||
{{ verteilung }} |
|||
\end{tikzpicture} |
|||
|
|||
|
|||
\end{document} |
|||
|
@ -1,10 +1,14 @@ |
|||
from django.urls import path |
|||
|
|||
from .views import index |
|||
from .views import view |
|||
from .views import search |
|||
from .views import download |
|||
|
|||
|
|||
urlpatterns = [ |
|||
path('', index, name='frontend_index'), |
|||
path('view', view, name='view'), |
|||
path('search',search,name='search'), |
|||
path('download',download) |
|||
] |
@ -1,2 +1,2 @@ |
|||
django |
|||
|
|||
django_tex |
|||
|
Loading…
Reference in new issue