What would the code be to fix this problem? Would I have ["12"] as the last line in the data or am I reading your response wrong? Thank you for your help!
On Apr 1, 2:32 pm, Sergey Grabkovsky <[email protected]> wrote: > Hello, the problem you're encountering is because your array is malformed. > If you'll notice, the last line of your array looks like "['12', ]", and > different browsers will interpret it differently. In Chrome specifically, > this is parsed to ["12"] -- a one element array. This means that you don't > have a valid 2D array that you're passing to the arrayToDataTable function. > If you'll take note of your console, you'll notice that it gives the error > "Not > a valid 2D array." > > Hope that helped! > > - Sergey > > On Mon, Apr 1, 2013 at 2:14 PM, Courtney <[email protected]>wrote: > > > > > I have created many different Google charts on different pages of a > > website. They all display on Internet Explorer, Mozilla, etc., but > > some display and some do not on Google Chrome and iPhones. There does > > not seem to be any correlation between the graphs that are not > > displaying. For some pages with multiple graphs, one will display > > while the other two will not. Here is an example of code for a graph > > that will not display on Google Chrome or an iPhone, but properly > > displays on Internet Explorer: > > > <SCRIPT src="https://www.google.com/jsapi" type=text/javascript></ > > SCRIPT> > > > <SCRIPT type=text/javascript> > > google.load("visualization", "1", {packages:["corechart"]}); > > google.setOnLoadCallback(drawChart); > > function drawChart(){ > > > var data = google.visualization.arrayToDataTable([ > > ['Year', 'Air Pollution Index'], > > ['85', 43], > > ['86', 37], > > ['87', 37], > > ['88', 36], > > ['89', 34.5], > > ['90', 32.5], > > ['91', 36.8], > > ['92', 29.8], > > ['93', 28.5], > > ['94', 30.8], > > ['95', 27.1], > > ['96', 27.6], > > ['97', 26.7], > > ['98', 27.7], > > ['99', 25.5], > > ['00', 27.25], > > ['01', 27.23], > > ['02', 25.65], > > ['03', 23.87], > > ['04', 22.41], > > ['05', 24.66], > > ['06', 22.85], > > ['07', 21.11], > > ['08', 19.31], > > ['09', 16.9], > > ['10', 15.2], > > ['11', 16.9], > > ['12', ] > > ]); > > > var options = { > > 'legend':'none', > > series: {0:{color: '#848484'}}, > > title: 'AIR POLLUTION INDEX', > > > titleTextStyle: {color: '#585858', fontName: 'arial narrow', bold: > > false, fontSize: '13'}, > > > 'lineWidth': '0', > > 'pointSize':'5', > > > hAxis: {title: 'Year', showTextEvery: '3',titleTextStyle: {color: > > '#585858', > > fontName:'arial narrow', bold:false, italic:false, > > fontSize:'12'},baselineColor:'#D8D8D8'}, > > > 'vAxis': {minValue: '0', maxValue: '50', baselineColor: 'FFFFFF'} > > }; > > > var chart = new > > google.visualization.AreaChart(document.getElementById('chart_div')); > > chart.draw(data, options); > > } > > </SCRIPT> > > > -- > > 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?hl=en. > > For more options, visithttps://groups.google.com/groups/opt_out.- Hide > > quoted text - > > - Show quoted text - -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
