Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions demo_project/demo/templates/demo/flot.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,19 @@ <h2>Pie Chart</h2>
</pre>
</div>
<br />
<h2>Area Chart</h2>
<div id="area_chart" class="well">
{{ area_chart.as_html }}
<pre class="code">
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"})
</pre>
</div>
{% endblock %}
5 changes: 4 additions & 1 deletion demo_project/demo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ def get_context_data(self, **kwargs):
options={'title': "Sales Growth"})
pie_chart = flot.PieChart(context["simple_data_source"],
options = {'title': "Sales Growth"})
area_chart = flot.AreaChart(context["simple_data_source"],
options = {'title': "Sales Growth"})
context.update({'point_chart': point_chart,
"pie_chart": pie_chart})
"pie_chart": pie_chart,
"area_chart": area_chart})
return context

flot_demo = FlotDemo.as_view(renderer=flot)
Expand Down
9 changes: 9 additions & 0 deletions graphos/renderers/flot.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ def get_options(self):

def get_js_template(self):
return 'graphos/flot/pie_chart.html'


class AreaChart(BaseFlotChart):

def get_options(self):
options = get_default_options("lines")
options["series"]["lines"] = {"fill": "true"}
options.update(self.options)
return options