-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
My view:
class BarChartJSONView(BaseColumnsHighChartsView):
def get_title(self):
return "Testing bar charts"
def get_labels(self):
return ['Africa', 'America', 'Asia', 'Europe', 'Oceania']
def get_yUnit(self):
return "What is this?!"
def get_providers(self):
return ["Year 1800", "Year 1900", "Year 2000"]
def get_data(self):
return [[107, 31, 635, 203, 2], [133, 156, 947, 408, 6], [1052, 954, 4250, 740, 38]]
My url:
path('chartJSON', views.BarChartJSONView.as_view(), name='bar_chart_json'),
Template:
<script type="text/javascript">
$.get('{% url "accounts:bar_chart_json" %}', function(data) {
var ctx = $("#myChart").get(0).getContext("2d");
new Chart(ctx, {
type: 'bar', data: data
});
});
</script>
Line chart works fine, but just a simple change to implement a bar chart just returns a grid with 1.0 max on Y axis.
Metadata
Metadata
Assignees
Labels
No labels