我有一个类别过滤器,用于选择绑定到饼图的日期。目前它显示默认标题(“选择一个值”)。我想将其默认值设置为包含的值之一,比如上次日期。
我怎样才能做到这一点?
谢谢!
我有一个类别过滤器,用于选择绑定到饼图的日期。目前它显示默认标题(“选择一个值”)。我想将其默认值设置为包含的值之一,比如上次日期。
我怎样才能做到这一点?
谢谢!
A little late but checkout this example:
// 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