Team:TU-Delft/SynBioData
From 2013.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
<html> | <html> | ||
- | + | ||
- | + | <script type="text/javascript"> | |
- | + | var isFirstTime = true; | |
+ | var options = {'showRowNumber': true}; | ||
+ | var data; | ||
+ | var queryInput; | ||
- | + | var query = new google.visualization.Query( | |
- | + | 'https://docs.google.com/spreadsheet/ccc?key=0ArsDNt8sj-LBdEdCREdxUTFmVXpPaTVnZm43d0RTdmc#gid=0'); | |
- | + | ||
- | + | ||
- | + | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | + | query.setQuery('SELECT A'); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | function sendAndDraw() { | |
- | + | // Send the query with a callback function. | |
- | + | query.send(handleQueryResponse); | |
- | + | } | |
- | + | ||
- | + | function handleQueryResponse(response) { | |
- | + | if (response.isError()) { | |
- | + | alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); | |
- | + | return; | |
- | + | } | |
- | + | data = response.getDataTable(); | |
- | + | var table = new google.visualization.Table(document.getElementById('querytable')); | |
- | + | table.draw(data, {'showRowNumber': false}); | |
- | + | if (isFirstTime) { | |
- | </ | + | init(); |
+ | } | ||
+ | } | ||
+ | |||
+ | function setQuery(queryString) { | ||
+ | // Query language examples configured with the UI | ||
+ | query.setQuery(queryString); | ||
+ | sendAndDraw(); | ||
+ | queryInput.value = queryString; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | google.setOnLoadCallback(sendAndDraw); | ||
+ | |||
+ | function init() { | ||
+ | isFirstTime = false; | ||
+ | (new google.visualization.Table(document.getElementById('table'))).draw(data, options); | ||
+ | queryInput = document.getElementById('display-query'); | ||
+ | } | ||
+ | |||
+ | function setQueryFromUser() { | ||
+ | setQuery(queryInput.value); | ||
+ | } | ||
+ | |||
+ | |||
+ | </script> | ||
</html> | </html> |
Revision as of 12:44, 2 September 2013