I am trying create script, where whenever, the page loads, it always renders the line and table chart, showing latest date data.
I have created the following code and assigned it to each of the charts state property and I am failing to get my desired output on the client-side:
****** Updated Code: ******
var latestDate = data.getColumnRange(5).max;
var table = new google.visualization.ChartWrapper({
containerId: 'table_div',
chartType: 'Table',
options: {
},
'state': {
'value': [latestDate]
}
});
Is there a better approach to carry out this task. Any help would be very much appreciated. Thanks
Your code is pretty extensive, but here is the main idea:
data = response.getDataTable();
var latestDate = data.getColumnRange(5).max; // get latest date
var dataview = new google.visualization.DataView(data); // create dataview to filter rows
dataview.setRows(dataview.getFilteredRows([{column:5, value: latestDate}])) // filter rows by latest date value
console.log(dataview.getDistinctValues(5)) // shows only latest date
Then you can set this dataView to the dashboard
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.