我在django项目中使用了chartit。 我有一个模型(ReadingSensor)具有以下属性:用Django中的chartit创建多个(两个)源代码
- id_sensor
- DATE_TIME
- 值
我想创建几行线图的不同id_sensors
:
ReadingSensor.objects.filter(id_sensor=2) ReadingSensor.objects.filter(id_sensor=1)
对于单一模式有:
ds = DataPool(
series=
[{'options': {
'source': MonthlyWeatherByCity.objects.all()},
'terms': [
'month',
'houston_temp',
'boston_temp']}
])
cht = Chart(
datasource = ds,
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'}}})
文档:http://chartit.shutupandship.com/docs/
我咨询的文件,但没有发现任何提示例子来帮助我。 有人可以帮我吗?
请把你的代码! –
我现在加了。抱歉 – roliveira