AnnotationCharts stopped working in IE over night.

100 views
Skip to first unread message

Cliff

unread,
Jul 9, 2020, 9:27:34 AM7/9/20
to Google Visualization API
Hello,

I''m working on an application using AnnotationCharts that has been running very well for some time now in Chrome, Edge, Firefox, Internet Explorer, and Opera browsers.   Yesterday it worked as expected in all browsers.
Today, it no longer works in  the Internet Explorer, but still works correctly in the other 4 browsers.  It does not render at all in IE.   The intended chart area is blank.  I generate a program in my code, write it out, and execute
it in an iframe.  The code I'm writing out that works in the 4 browsers, but not IE follows.


<HTML>   

                 <HEAD>                       

                   <SCRIPT TYPE='text/javascript' SRC='https://www.gstatic.com/charts/loader.js'></SCRIPT>

                   

                   <SCRIPT TYPE='text/javascript'>

                     google.charts.load('current', {'packages':['annotationchart']});

                     google.charts.setOnLoadCallback(drawChart);

       

                     function drawChart() {         

                       var data = new google.visualization.DataTable();         

                       data.addColumn('date', 'Date');

                       data.addColumn('number', 'State');

                       data.addColumn('string', 'title1');         

                       data.addColumn('string', 'text1');

                       data.addRows([                         [new Date(1997,0,1), 61.0, undefined, undefined],
                                                                         [new Date(1999,0,1), 67.1, undefined, undefined],
                                                                         [new Date(2001,0,1), 64.5, undefined, undefined],
                                                                         [new Date(2003,0,1), 67.5,'Funding Approved','The Universal Coverage Act funding is allocated.'],
                                                                         [new Date(2003,0,15), 67.5,'Insurance For All','The Universal Coverage Act of 2003 is proposed.'],
                                                                         [new Date(2003,2,15), 67.5,'Insurance Finally','The Universal Coverage Act of 2003 passes.'],
                                                                         [new Date(2004,1,1), 67.5,'Funding Begins','The Universal Coverage Act funding of 2003 begins with a bang.'],
                                                                         [new Date(2005,0,1), 69.2, undefined, undefined]                      ]); 
  

                       var chart = new google.visualization.AnnotationChart(document.getElementById('chart_div'));                     

                       chart.draw(data, {displayAnnotations: true, displayZoomButtons: false, allValuesSuffix: "'%", fill: 40, thickness: 1, colors:['#809FFF'], displayRangeSelector: false});       

                     }     

                     </SCRIPT>   

                   </HEAD>    

                   <BODY>      

                     

                     <DIV ID='chart_div' STYLE='WIDTH:800px;HEIGHT:380px;POSITION:relative;LEFT:1.5%;OVERFLOW:HIDDEN;'>

                       

                     </DIV>

   

                   </BODY>

</HTML>


Any help is appreciated.   Thanks,

Cliff

Cliff

unread,
Jul 9, 2020, 10:06:52 AM7/9/20
to Google Visualization API
My problem is what is talked about in the 'Object doesn't support 'assign' property or method' post.   I did insert Object.assign polyfill; as a line right in front of the google.charts.load( line.  But it did not change anything.  The AnnotationCharts chart does not render.    Cliff                                             

Dan Espich

unread,
Jul 9, 2020, 10:46:26 AM7/9/20
to Google Visualization API
I added this function before my  google.charts.load() line and it fixed it. Evidently it "rewrites" the object assign function in IE.

        if (typeof Object.assign !== 'function') {
            // Must be writable: true, enumerable: false, configurable: true
            Object.defineProperty(Object, "assign", {
                value: function assign(target, varArgs) { // .length of function is 2
                    'use strict';
                    if (target === null || target === undefined) {
                        throw new TypeError('Cannot convert undefined or null to object');
                    }

                    var to = Object(target);

                    for (var index = 1; index < arguments.length; index++) {
                        var nextSource = arguments[index];

                        if (nextSource !== null && nextSource !== undefined) {
                            for (var nextKey in nextSource) {
                                // Avoid bugs when hasOwnProperty is shadowed
                                if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
                                    to[nextKey] = nextSource[nextKey];
                                }
                            }
                        }
                    }
                    return to;
                },
                writable: true,
                configurable: true
            });

Cliff

unread,
Jul 9, 2020, 12:03:00 PM7/9/20
to Google Visualization API
Thanks Dan.  It worked.


On Thursday, July 9, 2020 at 9:27:34 AM UTC-4, Cliff wrote:

Daniel LaLiberte

unread,
Jul 9, 2020, 2:08:04 PM7/9/20
to google-visua...@googlegroups.com
The problem is with the loader itself, since the compiler implicitly uses Object.assign when compiling code like settings = {...settings}.    This was unexpected (by me) but I believe I will have a fix in a couple hours.

--
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/41a12cf0-3b56-44c6-9f99-47ba3709ec4bo%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages