diff --git a/demo_project/demo/templates/demo/flot.html b/demo_project/demo/templates/demo/flot.html index db0205d..2700fd9 100644 --- a/demo_project/demo/templates/demo/flot.html +++ b/demo_project/demo/templates/demo/flot.html @@ -73,4 +73,21 @@

Column Chart


+ +

Area Chart

+
+ {{ area_chart.as_html }} +
+            data = [
+                   ['Year', 'Sales', 'Expenses', 'Items Sold', 'Net Profit'],
+                   ['2004', 1000, 400, 100, 600],
+                   ['2005', 1170, 460, 120, 310],
+                   ['2006', 660, 1120, 50, -460],
+                   ['2007', 1030, 540, 100, 200],
+                   ]
+            data_source = SimpleDataSource(data)
+            chart = flot.AreaChart(data_source, options={'title': "Sales/ Expense"})
+        
+
+
{% endblock %} diff --git a/demo_project/demo/views.py b/demo_project/demo/views.py index 4e47b99..b3e343a 100755 --- a/demo_project/demo/views.py +++ b/demo_project/demo/views.py @@ -273,7 +273,10 @@ def get_context_data(self, **kwargs): data_source = context["data_source"] point_chart = self.renderer.PointChart(data_source, options={'title': "Sales Growth"}) - context["point_chart"] = point_chart + area_chart = flot.AreaChart(SimpleDataSource(data=data), + options={'title': "Sales Growth"}) + context.update({'point_chart': point_chart, + 'area_chart': area_chart}) return context flot_demo = FlotDemo.as_view(renderer=flot) diff --git a/graphos/renderers/flot.py b/graphos/renderers/flot.py index 05b67bb..7bf75cc 100644 --- a/graphos/renderers/flot.py +++ b/graphos/renderers/flot.py @@ -80,6 +80,15 @@ def get_options(self): options["horizontal"] = True return options +class AreaChart(BaseFlotChart): + + def get_options(self): + options = get_default_options("lines") + options.update({"series": {"lines": {"fill": "true"}}}) + options.update(self.options) + options["horizontal"] = True + return options + class PieChart(BaseFlotChart): pass # TODO