Looks like it might be a bug in the ChartWrapper? I did some debugging and 
found a possible issue where ChartWrapper (I think) checks for the chart 
type by looking at possible namespaces. The issue is that when there aren't 
any loaded packages that contain a 'Map' constructor function it lands on 
just 'Map'. The check always start from the Window object so when all other 
namespaces fail it succeeds on Window.Map, which is just a JavaScript Map 
data structure. I tested removing the last part of the array (the 'Map' 
value) and it successfully loaded the Google Maps api.

On Wednesday, April 14, 2021 at 10:23:35 PM UTC-7 Almania M wrote:

> Hello,
>
> According to the ChartWrapper docs, the ChartWrapper handles loading all 
> necessary libraries. If you have third party libraries then you must load 
> them yourself explicitly.
>
>    - ChartWrapper claiming to handle lading of all libraries here 
>    
> <https://developers.google.com/chart/interactive/docs/drawing_charts#chartwrapper>
>    - ChartWrapper constructor options claiming that you must load 
>    third-party libraries but not google.visualization libraries here 
>    <https://developers.google.com/chart/interactive/docs/reference#drawchart>
>
> I'm having problems loading a 'Map' chart type. When trying to load a map 
> I receive the error 'object is not iterable (cannot read property 
> Symbol(Symbol.iterator))' If I don't explicitly load the 'map' package. 
> Here's an example piece of code that can be run to reproduce the issue.
>
> <html>
>   <head>
>     <script type="text/javascript" src="
> https://www.gstatic.com/charts/loader.js";></script>
>     <script type="text/javascript">
>       google.charts.load('current');
>       // google.charts.load('current', { packages: ['map']});
>       google.charts.setOnLoadCallback(drawMap);
>
>       function drawMap() {
>         let mapWrapper = new google.visualization.ChartWrapper({
>             chartType: 'Map',
>             dataTable: [
>               ['lattitude', 'longitude', 'label'],
>               [-37.7647, 144.9393, 'hello'],
>               [40.4165, -3.7026, 'hello2']
>             ],
>             options: {'title': 'Stuff'},
>             container: document.getElementById('map_div')
>         });
>
>         mapWrapper.draw();
>       }
>     </script>
>   </head>
>   <body style="font-family: Arial;border: 0 none;">
>     <div id="map_div" style="width: 600px; height: 400px;"></div>
>   </body>
> </html>
>
> If you run as-is, you will receive the error. If you uncomment the load 
> call with the 'map' package then everything loads just fine. Is the Google 
> Maps library considered a third-party library or is this a bug or am I 
> missing something? Any help here would be greatly appriciated. Thank you!
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/4914bef6-2cf6-4796-9bf5-85ed2d8b5dcdn%40googlegroups.com.

Reply via email to