1👍
✅
I found the solution using django aggregate function. See below:
ds = PivotDataPool(
series=[
{'options': {
'source':Demographic.objects.all(),
'categories':['gender'] },
'terms':{
'sex_count':Count('gender'),
}
}
]
)
pvcht = PivotChart(
datasource=ds,
series_options =
[{'options':{
'type': 'column',
#'stacking': True
},
'terms':[
'sex_count']}],
chart_options =
{'title': {
'text': 'Total number'},
'xAxis': {
'title': {
'text': 'Sex'}}}
)
Source:stackexchange.com