Google Charts: 'undefined不是一个函数'添加hAxis-options时

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

本文关键字:一个 函数 添加 hAxis-options Charts undefined Google      更新时间:2023-09-26

我已经启动并运行了谷歌图表,它工作得很好。唯一的问题是,折线图y轴走向-20,000,而没有低于0的值。我尝试将两个轴的minValue设置为0,但是当我添加"vAxis"部分时,它返回"未定义不是函数"。当我离开"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,
      };

合适的选项是vAxis.viewWindow,而不是vAxis.viewMode:

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