Chart code suddenly stopped working

99 views
Skip to first unread message

Dustin Saunders

unread,
Feb 10, 2020, 1:21:20 PM2/10/20
to Google Visualization API
My JS for charts in my application suddenly stopped working.  Here's a sample:

data = new google.visualization.DataTable();
        data.addColumn('string', 'A');
        data.addColumn('string', 'B');
        data.addColumn('number', 'C');
        data.addColumn('number', 'D');
        data.addColumn('string', 'E');
        data.addColumn('string', 'F');
        data.addRows(chartData); 
        data.sort({ column: 2, desc: true });
        data.addColumn({ 'type': 'string', 'role': 'tooltip', 'p': { 'html': true } });
        data.wg.forEach(function (a) {
            a.c[6].v = 'G';
        });

And the error I get is:

Uncaught TypeError: Cannot read property 'forEach' of undefined
    at <anonymous>:11:17



It looks like the response has changed from data.wg  to data.Hg ?

Jeff Johnson

unread,
Feb 11, 2020, 8:55:24 AM2/11/20
to Google Visualization API
JS charts suddenly stopped working for me as well.

Explicitly loading version 46 instead of current fixed things for us.

Version 47 though came out in January, why would this only start affecting people today?

Daniel LaLiberte

unread,
Feb 11, 2020, 9:46:55 AM2/11/20
to Google Visualization API
Hi Dustin,

If you are using internal properties of the DataTable instance, they are certain to be changed with each new release, so you should try to find another way to achieve your goal that only uses the public API.  Even old releases might need to be updated, although we would be more likely to update the loader to redirect to newer releases.  Either way, your non-standard usage would be broken by the update.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/801c122f-c231-4f6b-abaf-25ec9a6d099a%40googlegroups.com.


--
dlaliberte@Google.com   Cambridge MA
go/gviz-headcount

Dustin Saunders

unread,
Feb 11, 2020, 11:50:15 AM2/11/20
to Google Visualization API
Thanks for the reply Jeff, explicitly loading 46 also worked for us.  

Same question about the Janurary release, because I noticed that today it was changed again from Hg to eg.  So I thought maybe my browser caches for a while but testing 'current' this morning shows that new change.

Daniel LaLiberte

unread,
Feb 11, 2020, 11:54:59 AM2/11/20
to Google Visualization API
In addition to avoiding the use of internal properties, if you feel the API should be enhanced with some additional capability, please let us know your reasons.  Maybe we will agree, or maybe we can suggest an alternative.

--
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.

Dustin Saunders

unread,
Feb 11, 2020, 11:56:06 AM2/11/20
to Google Visualization API
I'm mostly C# so I guess its surprising to me that the internal properties are subject to change so frequently but that explains why I couldn't find any documentation about it.  I'll change the code to use for loops to iterate and use setCell()-- thanks for the reply.


On Tuesday, February 11, 2020 at 8:46:55 AM UTC-6, Daniel LaLiberte wrote:
Hi Dustin,

If you are using internal properties of the DataTable instance, they are certain to be changed with each new release, so you should try to find another way to achieve your goal that only uses the public API.  Even old releases might need to be updated, although we would be more likely to update the loader to redirect to newer releases.  Either way, your non-standard usage would be broken by the update.

On Mon, Feb 10, 2020 at 1:21 PM Dustin Saunders wrote:
My JS for charts in my application suddenly stopped working.  Here's a sample:

data = new google.visualization.DataTable();
        data.addColumn('string', 'A');
        data.addColumn('string', 'B');
        data.addColumn('number', 'C');
        data.addColumn('number', 'D');
        data.addColumn('string', 'E');
        data.addColumn('string', 'F');
        data.addRows(chartData); 
        data.sort({ column: 2, desc: true });
        data.addColumn({ 'type': 'string', 'role': 'tooltip', 'p': { 'html': true } });
        data.wg.forEach(function (a) {
            a.c[6].v = 'G';
        });

And the error I get is:

Uncaught TypeError: Cannot read property 'forEach' of undefined
    at <anonymous>:11:17



It looks like the response has changed from data.wg  to data.Hg ?

--
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.


--
dlali...@Google.com   Cambridge MA
go/gviz-headcount

Stephen Ramsay

unread,
Feb 11, 2020, 2:03:56 PM2/11/20
to Google Visualization API
Thanks for posting this. I was getting confused as multiple websites I help with have all had google charts breaking today.
Reply all
Reply to author
Forward
0 new messages