我在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