[英]Changing Highcharts label and sorting x-axis using Django-chartit
我使用django-charit時遇到問題,它使用了Highcharts 。 到目前為止,這是我的代碼:
#creating chart
ds = DataPool(
series=
[{'options': {
'source': DataForecast.objects.all().order_by('id')},
'terms': [
'date_time',
'wl_observed_m',
'wl_forecasted_m']}
])
cht = Chart(
datasource=ds,
series_options=
[{'options': {
'type': 'line',
'stacking': False},
'terms': {
'date_time': [
'wl_observed_m',
'wl_forecasted_m']
}}],
chart_options=
{'title': {
'text': 'Forecast for January 19, 2014 2:00 PM'},
'xAxis': {
'title': {
'text': 'Date & Time'}},
'yAxis': {
'title': {
'text': 'Water Level, m.'}},
'credits': {
'enabled': False}})
輸出是這樣的:
那么,我該如何更改標簽(環繞)? 並對x軸進行排序。 我通過查詢嘗試了但沒有成功。
排序: DataForecast.objects.all().order_by('id')
使用.latest()
或.order_by('-date')
或datefield(打印到圖表的那個)而不是id排序查詢。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.