Javascript 谷歌图表:如何更改controlType:ControlWrapper的CategoryFilter中的默认选定值

Javascript 谷歌图表:如何更改controlType:ControlWrapper的CategoryFilter中的默认选定值,javascript,visualization,google-visualization,Javascript,Visualization,Google Visualization,我有一个类别过滤器,用于选择绑定到饼图的日期。目前,它将标题显示为默认值(“选择值”)。我想将其默认值设置为其中一个包含的值,例如last date 我该怎么做 谢谢 有点晚,但请检查此示例: // Load the Visualization API and the piechart package. google.load('visualization', '1.0', {'packages':['corechart']}); // Set a callback to run

我有一个类别过滤器,用于选择绑定到饼图的日期。目前,它将标题显示为默认值(“选择值”)。我想将其默认值设置为其中一个包含的值,例如last date

我该怎么做


谢谢

有点晚,但请检查此示例:

  // Load the Visualization API and the piechart package.
  google.load('visualization', '1.0', {'packages':['corechart']});

  // Set a callback to run when the Google Visualization API is loaded.
  google.setOnLoadCallback(drawChart);

  // Callback that creates and populates a data table,
  // instantiates the pie chart, passes in the data and
  // draws it.
  function drawChart() {

    // Create the data table.
    var data = google.visualization.arrayToDataTable([
      ['Year', 'Sales', 'Expenses'],
      ['2004',  1000,      400],
      ['2005',  1170,      460],
      ['2006',  660,       1120],
      ['2007',  1030,      540]
    ]);

    var options = {
      title: 'Company Performance'
    };

    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, options);
    //============All=U=Need============
    chart.setSelection([{'column': 1}]);
    //============All=U=Need============
  }
:D