简体   繁体   English

Google图表:添加hAxis-options时,“未定义不是函数”

[英]Google Charts: 'undefined is not a function' when adding hAxis-options

I've got Google Charts up and running, and it's working fine. 我已经启动并运行了Google图表,并且运行正常。 The only thing is that the line chart Y-axis goes to -20,000, whilst there is no value beneath 0. I tried setting the minValue of both axis to 0, but when I add the 'vAxis'-part, it returns a 'undefined is not a function'. 唯一的事情是,折线图的Y轴达到-20,000,而没有任何值低于0。我尝试将两个轴的minValue都设置为0,但是当我添加“ vAxis”部分时,它会返回“未定义不是函数”。 When I leave the 'vAxis'-part out of it, it works just fine... I was hoping anybody could help me with this? 当我将“ vAxis”部分排除在外时,它工作得很好……我希望有人可以为此提供帮助吗?

    var options2 = {
      'width': 1920,
      'height': 1000,
      'chartArea':{
        'left': 70,
        'top': 50,
        'width': 1700,
        'height': 750, 
      },
      //'legend':'none',
      'curveType': 'function',
      //'titlePosition':'none',
       'backgroundColor':{fill: 'transparent'},
      'title': '',
      'lineSize':5,
      'hAxis':{
        'minValue':0,
        'viewWindowMode':'explicit',
        'viewMode':{
          'min': 0,
        },
        'textStyle':{
          'color':'white',
        },
      },
      'vAxis':{
        'minValue':0,
        'maxValue':50000,
        'viewWindowMode': 'explicit',
      'viewMode':{
        'min':0,
        'max':50000,
      },
      'textStyle':{
        'color':'white',
      },
      },
      'animation':{
        'duration':1000,
        'easing': 'out'
      },
      'pointSize': 15,
      };

The appropriate option is vAxis.viewWindow , not vAxis.viewMode : 适当的选项是vAxis.viewWindow ,而不是vAxis.viewMode

'vAxis':{
    'viewWindow':{
        'min':0,
        'max':50000,
    },
    'textStyle':{
        'color':'white',
    }
},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM