--- a/OSSEval/analysis/views.py
+++ b/OSSEval/analysis/views.py
@@ -19,7 +19,7 @@
 from django.utils import simplejson, timezone
 from django.views.generic import ListView
 from xml.dom import minidom
-
+from pygal import Bar
 from forms import AnalysisForm, UploadFileForm, ImportChoice
 from analysis.models import Analysis, Instance, UploadedFile, Answer, Methodology, MethodologyVersion, Question, Page
 #from methodology.models import Methodology, MethodologyVersion, Question, Page
@@ -96,6 +96,40 @@
     
     return render(request, 'analysis/analysis_detail.html', {'analysis': analysis, 'analysis_detail': analysis_detail, 'search_html_ui': search_html_ui, 'weight_scenarios': weight_scenarios})
 
+def weight_scenario_graph(request, methodology_version_id):
+    mv = get_object_or_404(MethodologyVersion, pk=methodology_version_id)
+    weight_scenarios = mv.weightscenario_set.all()
+    bar_chart = Bar()
+    bar_chart.title = mv.methodology.name + ' scenario comparison'
+    bar_chart.x_labels = []
+    for ws in weight_scenarios:
+        ws.weights_for_graph = []
+    qs = []
+    for p in mv.page_set.all():
+        qs+= p.questions()
+    include_weight_scenario = {}
+    for ws in weight_scenarios:
+        include_weight_scenario[ws.id] = False
+    for q in qs:
+        include_this = False
+        for ws in weight_scenarios:
+            if ws.question_weight(q.id) != 1:
+                include_this = True
+        if include_this:
+            bar_chart.x_labels.append(q.text)
+            for ws in weight_scenarios:
+                this_weight = ws.question_weight(q.id)
+                if this_weight != 1:
+                    include_weight_scenario[ws.id] = True
+                ws.weights_for_graph.append(this_weight)
+    for ws in weight_scenarios:
+        if include_weight_scenario[ws.id]:
+            bar_chart.add(ws.name, ws.weights_for_graph)
+    weight_scenarios_graph = bar_chart.render()
+    methodology_name = mv.methodology.name
+    return render(request, 'analysis/weight_scenario_graph.html', {'weight_scenarios_graph': weight_scenarios_graph, 'methodology_name': methodology_name})
+
+
 def analysis_questions(request, analysis_id):
     analysis = get_object_or_404(Analysis, pk=analysis_id)
     weight_scenarios = analysis.methodology_version.weightscenario_set.all()