Hello, I try to get a google chart with an .csv table as source.
But my code is not running, in the console I receive following error: SCRIPT5007: Unable to get property 'Query' of undefined or null reference The test.csv ist stored on C:/ week,value1,value2 1,2,3 Is somebody here to help me out? <!DOCTYPE html> <meta content="de" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>TEST</title> <span class="tag" style="background-color: transparent; box-sizing: border- box; color: rgb(59, 120, 231); font-family: Roboto Mono,monospace; font-size : 14px; font-style: normal; font-variant: normal; font-weight: 400; letter- spacing: normal; orphans: 2; text-align: left; text-decoration: none; text- indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white- space: pre; word-spacing: 0px;"> <br /> </span> <p> </p> <head> <script type="text/javascript" src= "https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {packages: ['corechart']}); google.charts.setOnLoadCallback(drawChart); var queryOptions = { csvColumns: ['number', 'number', 'number' /* Or whatever the columns in the CSV file are */], csvHasHeader: true /* This should be false if your CSV file doesn't have a header */ } var csvUrl = 'file://C:/test.csv' var query = new google.visualization.Query(csvUrl, queryOptions); query.send(handleQueryResponse); function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response. getDetailedMessage()); return; } } function drawChart() { var data = response.getDataTable(); var chart = new google.visualization.PieChart(document.getElementById( 'myPieChart')); chart.draw(data, null); } </script> </head> <body> <div id="myPieChart"/> </body> </html> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/328d2dcc-818e-4372-b1e3-100d7bc21440%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
