我需要一个对其中一列进行自定义排序的谷歌图表表。
我用 sort: 'event, 我猜这应该发出一些可以捕获的事件,但没有找到任何关于它的信息。
最佳答案
使用事件处理程序捕获“排序”事件:
// table is your Table visualization
google.visualization.events.addListener(table, 'sort', function (e) {
// e.column is the column to sort
// e.ascending is a boolean, true for ascending sort, false for descending sort
// sort your data
// if you want the ascending/descending elements to work correctly, you need to specify the Table's sortColumn and sortAscending options when you redraw the Table, eg:
options.sortColumn = e.column;
options.sortAscending = e.ascending;
table.draw(sortedData, options);
});
关于google-visualization - 谷歌图表中的自定义排序功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25848409/