首页 > 解决方案 > 如何在控件的 Google 图表中将 ui.chartType 设置为 null?

问题描述

我正在使用带有图表范围过滤器控件的谷歌图表。该控件带有一个默认图表(可通过更改 ui.chartType 进行修改)。我想删除默认图表。我正在寻找像 ui.chartType = None 这样的东西来设置控制图的选项。它只是给出一个错误。

var control = new google.visualization.ControlWrapper({
      'controlType': 'ChartRangeFilter',
      'containerId': 'chartRangeFilter_control_div1',

      'options': {
        'filterColumnIndex': 0,


'ui': {
          'chartType': 'LineChart',
          'chartOptions': {
            'chartArea': {'width': '90%'},
            'hAxis': {'baselineColor': 'none'}
          },
          // Display a single series that shows the closing value of the stock.
          // Thus, this view has two columns: the date (axis) and the stock value (line series).
          'chartView': {
            'columns': [0, 3]
          },
          // 1 day in milliseconds = 24 * 60 * 60 * 1000 = 86,400,000
          'minRangeSize': 86400000
        }
      },
      'state': {'range': {'start': new Date(2012, 1, 9), 'end': new Date(2012, 2, 20)}}
    });

感谢帮助。

标签: chartsgoogle-visualization

解决方案


您应该可以使用该setOption方法

control.setOption('ui.chartType', null);

但是,我认为需要某种类型的图表...


推荐阅读