I have a problem using django-charit in which it utilizes Highcharts. So far, here is my code:
#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}})
The output of that is this:

So, how do I change the label(encircled)? and sort the x-axis. I tried it by the query but no success.
SORT :
DataForecast.objects.all().order_by('id')
sort query with .latest() or .order_by('-date') or by the datefield (the one you print to chart) instead of id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With