That code runs fine just by copy-pasting it into jsfiddle: http://jsfiddle.net/dlaliberte/Ly71ea8f/
So perhaps you are not running what you think you are. Perhaps your editor is causing some confusion. Could you post a link to a page where we can see what you are doing? On Tue, Nov 10, 2015 at 8:23 AM, Newbie <[email protected]> wrote: > Hi, > > I'm trying to create an interactive chart using apps script to embed on a > Google site. I'm using the following code to try and experiment, but > receiving the error message: Syntax error. (line 7, file "Code") > > Does anyone know how I can get around this! I've looked online for a while > and haven't been able to find anything but it's stopping me from being able > to progress further. > > Thanks for your help!! > > > (Code) > > <html> > <head> > <!--Load the AJAX API--> > <script type="text/javascript" > src="https://www.google.com/jsapi"></script> > <script type="text/javascript"> > > // Load the Visualization API and the piechart package. > google.load('visualization', '1.0', {'packages':['corechart']}); > > // Set a callback to run when the Google Visualization API is loaded. > google.setOnLoadCallback(drawChart); > > // Callback that creates and populates a data table, > // instantiates the pie chart, passes in the data and > // draws it. > function drawChart() { > > // Create the data table. > var data = new google.visualization.DataTable(); > data.addColumn('string', 'Topping'); > data.addColumn('number', 'Slices'); > data.addRows([ > ['Mushrooms', 3], > ['Onions', 1], > ['Olives', 1], > ['Zucchini', 1], > ['Pepperoni', 2] > ]); > > // Set chart options > var options = {'title':'How Much Pizza I Ate Last Night', > 'width':400, > 'height':300}; > > // Instantiate and draw our chart, passing in some options. > var chart = new > google.visualization.PieChart(document.getElementById('chart_div')); > chart.draw(data, options); > } > </script> > </head> > > <body> > <!--Div that will hold the pie chart--> > <div id="chart_div"></div> > </body> > </html> > > > This e-mail and any attachments are confidential and solely for the use of > the intended recipient. They may contain material protected by legal > professional or other privilege. If you receive it in error, please delete > it from your system, make no copies of it, do not disclose its contents to > any third party or use it for your own or any other person's benefit. > Please advise the sender of its receipt as soon as possible. Although this > email and its attachments are believed to be free of any virus or other > defect, it is the responsibility of the recipient to ensure that they are > virus free and no responsibility is accepted by the company for any loss or > damage arising from receipt or use thereof. Any opinions expressed that do > not relate to the official business of the company are those of the author, > not the United Biscuits group of companies. > > United Biscuits (UK) Limited Registered in England number 2506007 > Registered Office: Hayes Park, Hayes End Road, Hayes, Middlesex, UB4 8EE > > -- > 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 > http://groups.google.com/group/google-visualization-api. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-visualization-api/7b026c92-8f64-48bb-a39d-005cc4b67b1a%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/7b026c92-8f64-48bb-a39d-005cc4b67b1a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 5CC, Cambridge MA [email protected] <[email protected]> 9 Juniper Ridge Road, Acton MA -- 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 http://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMnj3-2LOW2Du3R1ppBgqHUXWqyyZZdvKGoa2UdLaoa0g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
