Commits

Chris Mutel committed aecb2a0

Working treemap

  • Participants
  • Parent commits 3b1009f

Comments (0)

Files changed (2)

 # -*- coding: utf-8 -*
-import base64
 from brightway2 import config, databases, methods, Database, Method
+from bw2analyzer import ContributionAnalysis
 from bw2calc import LCA
 from flask import Flask, url_for, render_template
+import base64
+import json
 
 app = Flask(__name__)
 
         lca = LCA(process, method)
         lca.lci()
         lca.lcia()
+        rt, rb = lca.reverse_dict()
+        context["treemap_data"] = json.dumps(ContributionAnalysis().d3_treemap(
+            lca.characterized_inventory.data, rb, rt))
         return render_template("lca.html", **context)
     else:
         return "No parameters"

bw2ui/web/templates/base.html

 	<!--[if lt IE 8]><link rel="stylesheet" href="{{ blueprint_ie }}" type="text/css" media="screen, projection"><![endif]-->
 	<script src="http://yui.yahooapis.com/3.7.3/build/yui/yui-min.js"></script>
 	<script src="http://d3js.org/d3.v2.min.js"></script>
+	{% block extrahead %}{% endblock %}
 </head>
 <body>
-	<!-- body -->
+	{% block body %}{% endblock %}
 </body>
 </html>