Embed Google Chart in MS Access

Mik Mak
Mik Mak used Ask the Experts™
on
I'm trying to embed a Google Chart in MS Access 2010/13/16, via a web browser AxtiveX linked to a local html file - contents shown below. But I only get an empty white page. Any ideas would be most welcome :)

content_copy
<html>
  <head>
    <script type='text/javascript' src='https://www.gstatic.com/charts/loader.js'></script>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type='text/javascript'>
     google.charts.load('current', {'packages': ['geochart']});
     google.charts.setOnLoadCallback(drawMarkersMap);

      function drawMarkersMap() {
      var data = google.visualization.arrayToDataTable([
        ['City',   'Population', 'Area'],
        ['Rome',      2761477,    1285.31],
        ['Milan',     1324110,    181.76],
        ['Naples',    959574,     117.27],
        ['Turin',     907563,     130.17],
        ['Palermo',   655875,     158.9],
        ['Genoa',     607906,     243.60],
        ['Bologna',   380181,     140.7],
        ['Florence',  371282,     102.41],
        ['Fiumicino', 67370,      213.44],
        ['Anzio',     52192,      43.43],
        ['Ciampino',  38262,      11]
      ]);

      var options = {
        region: 'IT',
        displayMode: 'markers',
        colorAxis: {colors: ['green', 'blue']}
      };

      var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    };
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
Does the page display correctly in IE 11?

Jim.
There is a security issue with local html pages. I haven't experienced it myself, but recall reading about it a few times. Try to look into the "Mark of the web" issue.
A quick google gave me the following link, try to look at that.
http://wiki.helpmvp.com/home/notes/javascript/markoftheweb
Mik MakConsultant

Author

Commented:
@Jim - yes it does

@Anders - I have tried to enable both of theses settings in IE that should control the local html page warning
1)Allow active content to run in files on My Computer
2)Allow Active Content from CDs to run on My Computer
3)"Mark of the web" put in the local html file, but it still only show a blank white page
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
The other issue can potentially be an invalid cache setting in the registry (that's why I asked about IE11, which is what that active-x control is based on).

If the user can't write to the local cache properly, pages will appear blank.   I had this happen with a client and Bing Maps.    Pages that don't use cache services appear normally.

Jim.
Mik MakConsultant

Author

Commented:
It's tested on 3 different machines with Win 7  32/64 bit and IE 11 - Works fine when doubleclicking the local file, but nothing is shown in the embedded Access/browser page
President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012
Commented:
OK, had the same problem here and got it to work.  It's either:

1. Active-x security blocking.

2. Rendering mode.

I believe it's #1.   #2 deals with the fact that the active-x control is in IE 7 mode unless you tell it otherwise, but once I got rid of the security issue, it rendered correctly with the default setup.

 BTW for info on the rendering and compatibility issues, have a look at:

 blogs.msdn.com/b/patricka/archive/2015/01/12/controlling-webbrowser-control-compatibility.aspx

and

https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version

Now to check for #1,

1.  place the file in your root C:\

2. Share out your root for everyone (i.e. CDRIVE)

3.  In IE settings, add:

file:\\<machine name>

 To the intranet location (use the advanced button to do so).

4. In your Access app, navigate to the URL with:

\\<machine name>\CDRIVE\<file name>.HTML

  Once I did that, it rendered fine.

Jim.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
BTW, if that works, then it boils down to security settings for Active-x and dovetails into Ander's comment.

Jim.
Mik MakConsultant

Author

Commented:
Hi Jim
#1 don't make any difference here when I'm already using the settings mentioned in my previous post. I'll have a go with your #2 suggestion, and report back :)
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
<<#1 don't make any difference here when I'm already using the settings mentioned in my previous post. I'll have a go with your #2 suggestion, and report back :)>>

 When you open the file directly in IE 11, do you get an active-x warning?

Jim.
Mik MakConsultant

Author

Commented:
No warnings in IE11
Mik MakConsultant

Author

Commented:
Hmm tried to add the registry keys for my 32bit on 32 bit test machine for MSACCESS.EXE - tried both IE11 settings with no luck.. :)
Mik MakConsultant

Author

Commented:
Setting the registry DWord value to 0 makes it work here, together with "Mark of the web" put in the local html file !

The writer on your link mentions it might be a way to Refer to the installed IE version
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
<<No warnings in IE11>>

Well given that, you should also check that cache registry key then, as it is something else. Key is:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\LowCache\Extensible Cache\DOMStore\CachePath

incorrect entry is:

%USERPROFILE%\AppData\Local\Microsoft\Internet Explorer\DOMStore

correct entry is:

%USERPROFILE%\AppData\LocalLow\Microsoft\Internet Explorer\DOMStore


'LocalLow', not 'local'

There's also a similar key for the medium cache:

KEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Extensible Cache\DOMStore\CachePath

correct value:

%USERPROFILE%\AppData\Local\Microsoft\Internet Explorer\DOMStore

You should not have to change this.

and last, on the cache problem, run the following command from a command line prompt:

icacls %userprofile%\Appdata\LocalLow /t /setintegritylevel (OI)(CI)L

This resets the folder security on the low cache folder.

 I would also add that I did get your file to display, although I did add:

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

 to the file.  I did just re-test though and it still loaded.

Jim.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
<<Setting the registry DWord value to 0 makes it work here, together with "Mark of the web" put in the local html file ! >>

 Ignore last comment then, except for the last sentence or two.  You might want to add that markup.  It tells the browser to use the latest version possible.

Jim.
Mik MakConsultant

Author

Commented:
Perfect Jim !

I was just testing on another machine with Acc2010 on a 64bit machin, where it didn't Work - but after adding then extra maktup you mentioned it Works great on this machine also :)

Thank you very much for your effort
Mik MakConsultant

Author

Commented:
Now I just need to find a way to transfer the data from the database into the map :)
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
That's another problem, and another question<g>.

Have a good day...

Jim.
Mik MakConsultant

Author

Commented:
I know :)

Same to you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial