【问题标题】:secondary axis title in Google chart's comboChart not workingGoogle图表的comboChart中的辅助轴标题不起作用
【发布时间】:2017-03-09 20:38:58
【问题描述】:
                chart.draw(data,{
                    colors:[self.model.get("color"), '#FF0000'],
                    height: 600,
                    title: self.model.get("title"),
                    chartArea: { width:'80%',height:'80%'},
                    legend: {position: 'bottom'},
                    animation:{
                        startup: true,
                        duration: 500,
                        easing: 'inAndOut',
                    },
                    vAxis:{
                    0:{
                            title:self.model.get("x_axis_label")
                        },
                    1:{
                            title:"Temperature"
                        }
                    },
                    hAxis:{
                        title:self.model.get("x_axis_label"),
                        slantedText: false,
                        slantedTextAngle: 0
                    },
                    series:
                    {
                        0: {
                            type:'bars',
                            targetAxisIndex:0
                        },
                        1: {
                            type:'line',
                            targetAxisIndex:1
                        }
                    }
                });

我有两个垂直轴(温度和千瓦时)。除了垂直轴的标题外,所有的东西都没有在图表上显示。我在选项中定义了 vAxis,在系列中定义了 targetAxisIndex。我搜索了谷歌,除了 vAxis 应该有两个垂直轴的 0:{} 和 1:{} 之外找不到任何东西。

【问题讨论】:

    标签: charts google-visualization


    【解决方案1】:

    当使用多个y轴时,需要使用 --> vAxes -- 带一个e -- 不是 vAxis

    此属性可以是对象{} 或数组[]

    对象...

    vAxes: {
      0: {
        title: self.model.get("x_axis_label")
      },
      1: {
        title: "Temperature"
      }
    },
    

    数组...

    vAxes: [
      {
        title: self.model.get("x_axis_label")
      },
      {
        title: "Temperature"
      }
    ],
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-23
      • 1970-01-01
      相关资源
      最近更新 更多