0

I'm just starting with JS using some basic google charts and I ran into a little problem. First, this is the full code:

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

      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Name');
        data.addColumn('string', 'Predecessor');
        data.addColumn('string', 'ToolTip');


        data.addRows([
        ['Mary', '', ''],
        ['John', 'Mary', '']
        ]);

        var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
        chart.draw(data, {'allowHtml':true});
      }
   </script>
    </head>
  <body>
    <div id="chart_div"></div>
  </body>
</html>

The way I need it to work is, getting data from another archive (txt, json, xml...). In short, I need ['Mary', '', ''], ['John', 'Mary', ''] to be fetched there, and this function just having the reference to that archive.

Thanks for the help, I know that this issue is probably extremely simple, but I think I'm using the wrong words to describe it, cause I don't find it anywhere.

  • 1
    Where is this "archive"? Is it a file in the same project? Is it somewhere on the local computer file system? Is it on another server? – Paddy Apr 12 '20 at 22:05
  • local computer file, in Documents, or C: for example – Joao Gabriel Apr 12 '20 at 22:08
  • https://stackoverflow.com/questions/19706046/how-to-read-an-external-local-json-file-in-javascript – Paddy Apr 12 '20 at 22:11
  • I think this will help you. – Paddy Apr 12 '20 at 22:11
  • Does this answer your question? [How to read an external local JSON file in JavaScript?](https://stackoverflow.com/questions/19706046/how-to-read-an-external-local-json-file-in-javascript) – Paddy Apr 12 '20 at 22:12

0 Answers0