使用Djangocharti更改Highcharts标签并排序xaxis

2024-09-30 12:15:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用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}})

结果是: enter image description here

那么,如何更改标签(环绕)?对x轴进行排序。我试了一下,但没有成功。在


Tags: djangotextfalsedatetimetitlechartds

热门问题