pizza-chart.html
727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{% load i18n %}
<script src="{{ STATIC_URL }}third-party/highcharts/js/highcharts.js"></script>
<script>
$(function () {
$('#{{ chart_div }}').highcharts({
chart: {
type: 'pie',
height: {{ chart_height }},
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
title: {
text: {% if chart_title %}'{{ chart_title }}'{% else %}''{% endif %}
},
series: [{
data: [
{% for option, value in chart_data.items %}
['{{ option }}', {{ value }}],
{% endfor %}
],
name: '{{ name }}'
}]
});
});
</script>