Desktop productivity for business analysts and programmers

Javascript visualisations (D3, google charts etc) in SAS EG browser not working?

Accepted Solution Solved
Reply
Highlighted
New Contributor
Posts: 4
Accepted Solution

Javascript visualisations (D3, google charts etc) in SAS EG browser not working?

Hi!

 

When i try to use Google Charts to make a Sankey Diagram in SAS eg i cant view it in the "SAS EG browser". If I right click and choose "open with windows default" then it works fine in Firefox.

 

Am I doing something wrong or are JS visualisations such as google charts not supported by the SAS eg ouput viewer browser? 

 

My code:

filename _webout "out2.html";
data _null_;
 file _webout;
put ' <html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load("current", {"packages":["sankey"]});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn("string", "From");
        data.addColumn("string", "To");
        data.addColumn("number", "Weight");
        data.addRows([
          [ "A", "X", 5 ],
          [ "A", "Y", 7 ],
          [ "A", "Z", 0 ],
          [ "B", "X", 2 ],
          [ "B", "Y", 9 ],
          [ "B", "Z", 4 ]
        ]);
       
        var options = {
          width: 600,
        };

        var chart = new google.visualization.Sankey(document.getElementById("sankey_basic"));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="sankey_basic" style="width: 900px; height: 300px;"></div>
  </body>
</html>'
;;;;;;;
run;

The error I get in SAS EG when viewing the ouput there:

image.png

 

Best regards


Accepted Solutions
Solution
‎01-03-2018 11:16 AM
Community Manager
Posts: 3,357

Re: Javascript visualisations (D3, google charts etc) in SAS EG browser not working?

The embedded browser in EG is a hosted version of the Microsoft IE component that's built into Windows.  You can change your EG preferences to always open HTML output in an external window (Chrome or FF).  The embedded browser won't be able to run your scripts.

View solution in original post


All Replies
Solution
‎01-03-2018 11:16 AM
Community Manager
Posts: 3,357

Re: Javascript visualisations (D3, google charts etc) in SAS EG browser not working?

The embedded browser in EG is a hosted version of the Microsoft IE component that's built into Windows.  You can change your EG preferences to always open HTML output in an external window (Chrome or FF).  The embedded browser won't be able to run your scripts.

Super Contributor
Posts: 320

Re: Javascript visualisations (D3, google charts etc) in SAS EG browser not working?

Posted in reply to ChrisHemedinger
Ahah, I figured you'd come the moment I hit my answer button... Is the hosted version available somewhere to run (in order to test things) or is it hidden in a DLL and unaccessible outside? I expected to find an "iexplore.exe" or something similar hanging around somewhere in the SAS folders, but I couldn't find it.
Community Manager
Posts: 3,357

Re: Javascript visualisations (D3, google charts etc) in SAS EG browser not working?

Posted in reply to snoopy369

@snoopy369 - it's wrapped up in the WebBrowser control that's part of the .NET Framework.  Under the surface, it is using some DLLs that are shared with IE.  It would be simple to build a small app that could be used for testing, but there isn't a way (that I know of) to drive EG to do this for you.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 247 views
  • 3 likes
  • 3 in conversation