Always getting missing } after property list when using data.addRow

27 views
Skip to first unread message

harleyhar

unread,
Sep 1, 2015, 11:42:42 AM9/1/15
to Google Visualization API
I wrote this program about five years ago that uses the API. Now all of a sudden it always throws this error - missing } after property list - when it gets to data.addRow.

Here is an example. Has something changed recently that may be causing this?

<script type='text/javascript'>
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Country');
data.addColumn('number', 'COUNT of EOR Method');
data.addRow(['Argentina', {v: 1, f: '1'}]);
data.addRow(['Brazil', {v: 8, f: '8'}]);
data.addRow(['Canada', {v: 74, f: '74'}]);
data.addRow(['China', {v: 60, f: '60'}]);
data.addRow(['Colombia', {v: 2, f: '2'}]);
data.addRow(['Denmark', {v: 1, f: '1'}]);
data.addRow(['Germany', {v: 23, f: '23'}]);
data.addRow(['India ', {v: 5, f: '5'}]);
data.addRow(['Indonesia', {v: 3, f: '3'}]);
data.addRow(['Libya', {v: 1, f: '1'}]);
data.addRow(['Norway', {v: 11, f: '11'}]);
data.addRow(['Romania', {v: 1, f: '1'}]);
data.addRow(['Trinidad and Tobago', {v: 32, f: '32'}]);
data.addRow(['Turkey', {v: 1, f: '1'}]);
data.addRow(['United Arab Emirates', {v: 1, f: '1'}]);
data.addRow(['United Kingdom', {v: 6, f: '6'}]);
data.addRow(['United States', {v: 371, f: '371'}]);
data.addRow(['Venezuela', {v: 51, f: '51'}]);
var chart = new google.visualization.ColumnChart(document.getElementById('chartArea'));

chart.draw(data, {width: 1140, height: 900, title: 'COUNT of EOR Method by Country', titleTextStyle: {color: 'black', fontName: 'Arial', fontSize: 18}, tooltipTextStyle: {color: 'black', fontName: 'Arial', fontSize: 18}
, backgroundColor: '#FFFFFF', fontSize: 11, legendTextStyle: {color: 'black', fontName: 'Arial', fontSize: 14}
, vAxis: {title: 'Country', titleTextStyle: {color: 'black', fontName: 'Arial', fontSize: 18}, slantedTextAngle: 90}
, chartArea:{top:70,left:160, height:600, width:840}
});
}
google.setOnLoadCallback(drawVisualization);
</script>



Daniel LaLiberte

unread,
Sep 1, 2015, 2:07:05 PM9/1/15
to Google Visualization API
Your code appears to work for us. See: http://jsfiddle.net/rf4hsmcm/
Does this work for you?  If not, which browser and OS are you using?

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
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/a4b6ea56-b303-46f5-b901-bbfc2a33a178%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

harleyhar

unread,
Sep 1, 2015, 2:39:47 PM9/1/15
to Google Visualization API
Yes, what you have in the jsfiddle works for me. Maybe it's just certain data values that cause the error like this one here:

function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'EOR Method');
data.addColumn('number', 'Country');
data.addRow(['Chemical AS', {v: United States, f: 'United States'}]);
data.addRow(['Chemical ASP', {v: Venezuela, f: 'Venezuela'}]);
data.addRow(['Chemical CDG', {v: China, f: 'China'}]);
data.addRow(['Chemical Micellar Polymer', {v: Indonesia, f: 'Indonesia'}]);
data.addRow(['Chemical Polymer', {v: India , f: 'India '}]);
data.addRow(['Chemical PS', {v: United States, f: 'United States'}]);
data.addRow(['FAWAG', {v: Norway, f: 'Norway'}]);
data.addRow(['Immiscible CO2 ', {v: Turkey, f: 'Turkey'}]);
data.addRow(['Immiscible Hydrocarbon', {v: Canada, f: 'Canada'}]);
data.addRow(['Immiscible Hydrocarbon WAG', {v: Venezuela, f: 'Venezuela'}]);
data.addRow(['Immiscible Nitrogen', {v: United States, f: 'United States'}]);
data.addRow(['Immiscible WAG', {v: Norway, f: 'Norway'}]);
data.addRow(['Microbial', {v: Venezuela, f: 'Venezuela'}]);
data.addRow(['Miscible Acid Gas', {v: Canada, f: 'Canada'}]);
data.addRow(['Miscible CO2 ', {v: Brazil, f: 'Brazil'}]);
data.addRow(['Miscible Gas ', {v: Norway, f: 'Norway'}]);
data.addRow(['Miscible Hydrocarbon ', {v: Venezuela, f: 'Venezuela'}]);
data.addRow(['Miscible Nitrogen', {v: United States, f: 'United States'}]);
data.addRow(['Miscible WAG', {v: United Kingdom, f: 'United Kingdom'}]);
data.addRow(['Nitrogen', {v: Venezuela, f: 'Venezuela'}]);
data.addRow(['SWAG', {v: Denmark, f: 'Denmark'}]);
data.addRow(['Thermal (Combustion)', {v: India , f: 'India '}]);
data.addRow(['Thermal (Hot Water)', {v: Germany, f: 'Germany'}]);
data.addRow(['Thermal (Steam)', {v: Venezuela, f: 'Venezuela'}]);
data.addRow(['WAG', {v: Venezuela, f: 'Venezuela'}]);
var chart = new google.visualization.ColumnChart(document.getElementById('chartArea'));

chart.draw(data, {width: 1140, height: 900, title: 'Country by EOR Method', titleTextStyle: {color: 'black', fontName: 'Arial', fontSize: 18}, tooltipTextStyle: {color: 'black', fontName: 'Arial', fontSize: 18}
, backgroundColor: '#FFFFFF', fontSize: 11, legendTextStyle: {color: 'black', fontName: 'Arial', fontSize: 14}
, vAxis: {title: 'EOR Method', titleTextStyle: {color: 'black', fontName: 'Arial', fontSize: 18}, slantedTextAngle: 90}
, chartArea:{top:70,left:160, height:600, width:840}
});
}
google.setOnLoadCallback(drawVisualization);
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA

Daniel LaLiberte

unread,
Sep 1, 2015, 2:46:35 PM9/1/15
to Google Visualization API
Your values are not quoted here, so that explains the problem with this data.   e.g. United States should be in quotes: 'United States'. 

I haven't looked at your actual data from the page you cited, but it sounds like you are experiencing a syntax error that is probably caused by your data.  

To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 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 google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

harleyhar

unread,
Sep 1, 2015, 3:03:12 PM9/1/15
to Google Visualization API
Ahh! Ok thanks. I'll fix my code.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 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 google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
Reply all
Reply to author
Forward
0 new messages