Djangochardit highcharts options对象“chart”不显示subti

2024-05-31 12:59:18 发布

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

使用图表选项中的“图表”选项时,在显示的图表中会得到不同的结果。示例1将显示字幕,但不显示背景色。示例2将显示背景色,但不显示字幕。还有人遇到过这种行为吗?在

Python 2.7.5版
Django v1.10
django chartit v0.2.7版
django highcharts v0.1.7版

Example 1: displays subtitle, not backgroundColor
#Create the PivotChart object
site_prod_pivotcht = PivotChart(
  datasource = site_prod_ds,
    series_options = [
          {'options':{
              'type': 'column',
              'stacking': False},
            'terms': [
              'prod_value',
              'wx_adj_value']}
        ],
        chart_options =
            {'title': {
               'text': 'Actual versus Wx Adjusted Production Data'},
             'subtitle': {
               'text': report_range},
           'backgroundColor': '#7FFFD4',
           'xAxis': {
                'title': {
                   'text': 'Group:Sites'}}
        }

Example 2: displays backgroundColor, not subtitle
#Create the PivotChart object
site_prod_pivotcht = PivotChart(
  datasource = site_prod_ds,
    series_options = [
          {'options':{
              'type': 'column',
              'stacking': False},
            'terms': [
              'prod_value',
              'wx_adj_value']}
        ],
        chart_options =
            {'chart':{
             'title': {
               'text': 'Actual versus Wx Adjusted Production Data'},
             'subtitle': {
               'text': report_range},
           'backgroundColor': '#7FFFD4',
           'xAxis': {
                'title': {
                   'text': 'Group:Sites'}}}
        }

Tags: text示例titlevalue选项chart图表site
1条回答
网友
1楼 · 发布于 2024-05-31 12:59:18

经过一点尝试和错误,我发现了以下工作的意图。在

chart_options =
    {'chart':{
        'backgroundColor': '#7FFFD4',
        'title': {
            'text': 'Actual versus Wx Adjusted Production Data'}},
     'subtitle': {
        'text': report_range},
     'credits': {
        'enabled': False},
     'xAxis': {
        'title': {
            'text': 'Group:Sites'}}
    }

相关问题 更多 >