Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
ArcGIS JS and Google Charts JS not working together

So I recently encountered a problem where I load both ArcGIS scripts and Google Charts scripts. I'm building out a website where I need both to work on the same page. However, I haven't been able to come up with a solution.

My code is simple and as follows:

<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://js.arcgis.com/4.23/" defer></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

<div id="sankey_basic" style="width: 900px; height: 300px;"></div>

<script>
$(document).ready(function(){

  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', 6 ],
      [ 'B', 'X', 2 ],
      [ 'B', 'Y', 9 ],
      [ 'B', 'Z', 4 ]
    ]);

    // Sets chart options.
    var options = {
      width: 600,
    };

    // Instantiates and draws our chart, passing in some options.
    var chart = new google.visualization.Sankey(document.getElementById('sankey_basic'));
    chart.draw(data, options);
  }
});
</script>

I set up a CodePen at https://codepen.io/bryant-essense/pen/YzeZrOp, https://codepen.io/bryant-essense/pen/YzeZrOp to replicate the problem.

Notice the "d3.sankey is not a function" message however when you remove or uncomment the ArcGIS script file, Google Charts work correctly, is there a workaround for this?

When I pull in a random ArcGIS chart it looks like both scripts (ArcGIS and Google Charts) are pulling in d3.js libraries,

The console produces the following errors:

enter image description here

Looking further into the issue I come across this link: https://community.esri.com/t5/arcgis-api-for-javascript-questions/multipledefine-error-in-dojoloader/td-p/714961.

Seems we can assign aliases, I'm very unfamiliar with the dojo.js library and modules so any help with this matter is appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!