here is link to .csv data Roni (google spreadsheet). thanks in advance for helping with query. https://docs.google.com/spreadsheet/pub?key=0Aha5Qc1venTTdEVOOGhZRUlvMENZNzBxdGNadE9jWXc&output=html
On Dec 8, 11:16 am, paulmo <[email protected]> wrote: > hi Roni, debugging, 404 Not Found error here: > var query = new google.visualization.Query('csv?url=http://localhost/ > test.csv'); > > But this is a correct file path. This is what the .csv looks like when > opened in browser into spreadsheet (gnumeric linux) from file path: > H (MW) (MW) (MW) > G 7. Interchange Summary > D NYISO AC Ties -300 1200 286 > D NYISO NNC -200 200 200 > D NYISO CSC -346 330 330 > D NB -800 550 -119 > D Phase 2 -2000 1200 -1424 > > thanks for suggestions. > > query.setQuery('select Phase 2, sum(MW) group by Phase 2'); > > On Dec 8, 10:37 am, Roni Biran <[email protected]> wrote: > > > > > > > > > Hi Paul, > > > Try debugging your application and see what type of element you're getting. > > It looks to me as though you're not getting the proper data into the Query > > object. This might cause the empty page. > > > Maybe you're getting another JavaScript error that kills the entire > > application.... try debugging it. > > If you're using Chrome/Firefox/IE, you can press F12 -> scripts and go on > > from there. > > > Roni > > > On Thu, Dec 8, 2011 at 5:33 PM, paulmo <[email protected]> wrote: > > > thanks so much roni for getting me started! here is a sample > > > from .csv.: > > > > "D","Additional Capacity Available from OP 4 Actions:","0" > > > "H","DESCRIPTION","TRANSFER LIMIT IN","TRANSFER LIMIT OUT","SCHEDULED > > > CONTRACT" > > > "H","(MW)","(MW)","(MW)" > > > "G","7. Interchange Summary" > > > "D","NYISO AC Ties",-300,1200,286 > > > "D","NYISO NNC",-200,200,200 > > > "D","NYISO CSC",-346,330,330 > > > "D","NB",-800,550,-119 > > > "D","Phase 2",-2000,1200,-1424 > > > "D","Highgate",-218,0,-218 > > > > I have edited this section of your script to reflect data > > > (above)...getting blank page. > > > > query.setQuery('select SCHEDULED CONTRACT, sum(MW) group by SCHEDULED > > > CONTRACT'); > > > > thanks in advance for help! paul > > > > On Dec 8, 3:14 am, Roni Biran <[email protected]> wrote: > > > > Hi paulmo, > > > > > Sadly you did not follow the exact instructions :-( > > > > > 1. The code you copied is a servlet code (i.e. runs on the server. this > > > is > > > > not a client side JavaScript). > > > > 2. Your script should hold a function named "drawChart" that will be > > > called > > > > after the page load is completed (google.setOnLoadCallback). That > > > function > > > > will call another function with the data that will eventually draw the > > > > chart. > > > > 3. Your CSV in inaccessible here. Can you send a sample from the CSV > > > > itself. If I were you, I would use the Google spreadsheet as an example. > > > > > After saying all that (and assuming that your CSV works), your script > > > > should look something like this: > > > > > <script type="text/javascript"> > > > > google.load('visualization', '1', {'packages':['corechart']}); > > > > google.setOnLoadCallback(drawChart); > > > > > function drawChart() { > > > > var query = new google.visualization.Query('csv?url= > > >http://www.iso-ne.com/sys_ops/csvdocs/morning_report2011-12-07-08-18.... > > > > query.setQuery('select dept, sum(salary) group by dept'); > > > > query.send(handleQueryResponse); > > > > > } > > > > > function handleQueryResponse(response) { > > > > if (response.isError()) { > > > > alert('Error in query: ' + response.getMessage() + ' ' + > > > > response.getDetailedMessage()); > > > > return; > > > > > } > > > > > var data = response.getDataTable(); > > > > var chart = new > > > > google.visualization.OrgChart(document.getElementById('csv_div')); > > > > chart.draw(data);} > > > > > </script> > > > > > Best of luck, > > > > > On Thu, Dec 8, 2011 at 2:55 AM, paulmo <[email protected]> wrote: > > > > > Have implemented according to instructions. CSV contains text and > > > > > numbers. My page is below, but first, if it helps, this is how > > > > > the .csv renders into JSON (but I'm not using JSON in external csv > > > > > file example). Thanks in advance for help. > > > > > [{"C":"C","Morning Report":"Report for 12\/7\/2011"},{"C":"C","Morning > > > > > Report":"Report Generated 12\/07\/2011 13:18:10 GMT"}, > > > > > {"C":"H","Morning Report":"DESCRIPTION"},{"C":"H","Morning > > > > > Report":""}, > > > > > {"C":"G","Morning Report":"Report Type"},{"C":"D","Morning > > > > > Report":"Morning Report"},{"C":"H","Morning Report":"DATE","":"TIME"}, > > > > > {"C":"H","Morning Report":"","":""},{"C":"G","Morning Report":"1. > > > > > Report Date"},{"C":"D","Morning Report":"Wednesday, Dec 7 > > > > > 2011","":"08:18:10 EST"},{"C":"H","Morning > > > > > Report":"DESCRIPTION","":"VALUE"},{"C":"H","Morning > > > > > Report":"","":"(MW)"},{"C":"G","Morning Report":"2. Peak Load"}, > > > > > {"C":"D","Morning Report":"Tuesday, Dec 6 2011 hour ending > > > > > 18","":"17755"},{"C":"G","Morning Report":"3. Operable Capacity > > > > > Analysis"},{"C":"D","Morning Report":"A. Capacity Supply Obligation > > > > > (CSO)","":"30957"},{"C":"D","Morning Report":"B. Capacity Additions > > > > > EcoMax Bid > CSO","":"2272"},{"C":"D","Morning Report":"C. Pre-OP4 > > > > > Dispatchable Loads","":"0"},{"C":"D","Morning Report":"D. Generation > > > > > Outages and Reductions","":"4474"},{"C":"D","Morning Report":"E. > > > > > Uncommitted Available Generation (non fast start)","":"9070"}, > > > > > {"C":"G","Morning Report":"F. Capacity Deliveries: Net Purchases = (-) > > > > > Net Sales = (+)"},{"C":"D","Morning Report":"NYISO AC Ties","":"167"}, > > > > > {"C":"D","Morning Report":"NYISO NNC","":"200"},{"C":"D","Morning > > > > > Report":"NYISO CSC","":"330"},{"C":"D","Morning > > > > > Report":"NB","":"222"}, > > > > > {"C":"D","Morning Report":"Phase 2","":"-1225"},{"C":"D","Morning > > > > > Report":"Highgate","":"-218"},{"C":"D","Morning Report":"Net > > > > > Deliveries","":"-524"},{"C":"D","Morning Report":"G. Total Available > > > > > Capacity (A+B+C-D-E-F)","":"20209"},{"C":"D","Morning Report":"H. Peak > > > > > Load Forecast For Hour 18","":"17900"},{"C":"D","Morning Report":"I. > > > > > Total Operating Reserve Requirement","":"1863"},{"C":"D","Morning > > > > > Report":"J. Capacity Required","":"19763"},{"C":"D","Morning > > > > > Report":"K. Surplus = (+) Deficiency = (-) (G - J)","":"446"}, > > > > > {"C":"D","Morning Report":"L. Replacement Reserve > > > > > Requirement","":"0"}, > > > > > {"C":"D","Morning Report":"M. Excess Commitment Surplus = (+) > > > > > Deficiency = (-) (K - L)","":"446"},{"C":"G","Morning Report":"4. > > > > > Largest First Contingency"},{"C":"D","Morning > > > > > Report":"____","":"1245"},{"C":"G","Morning Report":"5. Annual > > > > > Maintenance Schedule (A.M.S)"},{"C":"D","Morning Report":"Peak Load > > > > > Exposure","":"20393"},{"C":"G","Morning Report":"6. Reserve Summary"}, > > > > > {"C":"D","Morning Report":"Ten Minute Reserve > > > > > Requirement:","":"1245"}, > > > > > {"C":"D","Morning Report":"Ten Minute Reserve Estimate:","":"1245"}, > > > > > {"C":"D","Morning Report":"Thirty Minute Reserve > > > > > Requirement:","":"618"},{"C":"D","Morning Report":"Thirty Minute > > > > > Reserve Estimate:","":"1064"},{"C":"D","Morning Report":"Expected ICU > > > > > Operation","":"0"},{"C":"D","Morning Report":"Expected Actions of OP > > > > > 4:","":"0"},{"C":"D","Morning Report":"Additional Capacity Available > > > > > from OP 4 Actions:","":"0"},{"C":"H","Morning > > > > > Report":"DESCRIPTION","":"SCHEDULED CONTRACT"},{"C":"H","Morning > > > > > Report":"(MW)","":"(MW)"},{"C":"G","Morning Report":"7. Interchange > > > > > Summary"},{"C":"D","Morning Report":"NYISO AC Ties","":"167"}, > > > > > {"C":"D","Morning Report":"NYISO NNC","":"200"},{"C":"D","Morning > > > > > Report":"NYISO CSC","":"330"},{"C":"D","Morning > > > > > Report":"NB","":"222"}, > > > > > {"C":"D","Morning Report":"Phase 2","":"-1225"},{"C":"D","Morning > > > > > Report":"Highgate","":"-218"},{"C":"H","Morning > > > > > Report":"CITY","":"HIGH TEMP"},{"C":"H","Morning Report":"","":"(F)"}, > > > > > {"C":"G","Morning Report":"8. Weather Forecast Summary for the Peak > > > > > Hour"},{"C":"D","Morning Report":"Boston","":"45"},{"C":"D","Morning > > > > > Report":"Hartford","":"46"},{"C":"H","Morning > > > > > Report":"DESCRIPTION","":"VALUE"},{"C":"H","Morning Report":"","":""}, > > > > > {"C":"G","Morning Report":"9. SAR Available"},{"C":"D","Morning > > > > > Report":"NYISO","":"Yes"},{"C":"H","Morning > > > > > Report":"DESCRIPTION","":"VALUE"},{"C":"H","Morning > > > > > Report":"","":"(MW)"},{"C":"G","Morning Report":"10. Capacity of Non- > > > > > Commercial Units"},{"C":"D","Morning Report":"Total > > > > > Available","":"0"}, > > > > > {"C":"G","Morning Report":"11. Units Committed to Meet Minimum > > > > > Operating Reserve and Replacement Reserve Requirements"}, > > > > > {"C":"D","Morning Report":"0 Units","":"0"},{"C":"H","Morning > > > > > Report":"DESCRIPTION","":"VALUE"},{"C":"H","Morning Report":"","":""}, > > > > > {"C":"G","Morning Report":"12. Solar Magnetic Disturbance Activity"}, > > > > > {"C":"D","Morning Report":"Forecast:","":""},{"C":"D","Morning > > > > > Report":"Alert:","":""},{"C":"D","Morning Report":"Intensity:","":""}, > > > > > {"C":"D","Morning Report":"Observed Activity:","":""}, > > > > > {"C":"D","Morning Report":"Actions Taken or Planned by > > > > > ISO-NE:","":""}, > > > > > {"C":"D","Morning Report":"Actions Taken or Planned by Other Control > > > > > Areas:","":""},{"C":"T","Morning Report":"44 Lines"}] > > > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > > > > > <head> > > > > > <!--Load the AJAX API--> > > > > > <script type="text/javascript" src="https://www.google.com/ > > > > > jsapi"></script> > > > > > <script type="text/javascript" src="jquery-1.7.1.min.js"></script> > > > > > <script type="text/javascript"> > > > > > > // Load the Visualization API and the piechart package. > > > > > google.load('visualization', '1', {'packages':['corechart']}); > > > > > > // Set a callback to run when the Google Visualization API is > > > > > loaded. > > > > > google.setOnLoadCallback(drawChart); > > > > > > query = new google.visualization.Query('csv?url=http://www.iso-ne.com/ > > > > > sys_ops/csvdocs/morning_report2011-12-07-08-18.csv'); > > > > > > var chart = new > > > > > google.visualization.OrgChart(document.getElementById('csv_div')); > > > > > > </script> > > > > > </head> > > ... > > read more » -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
