Using D3.js in our application
In our application, we will explore using D3 to add graphs to our application. We'll use it to replace parts of the dojox/charting
code where we add the graphs to our map popup. Many of the steps will be similar, but some will be different.
Adding D3.js to the configuration
Since our application relies heavily on the Dojo framework, we will add our D3.js
library with AMD. We'll add the reference to D3 in our dojoConfig.packages
list. The new dojoConfig
script should look like the following:
dojoConfig = { async: true, packages: [ { name: 'y2k', location: location.pathname.replace(/\/[^\/]*$/, '') +'/js' }, { name: "d3", location: "http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.12/" } ] };
Now that our AMD code knows ...
Get Mastering ArcGIS Server Development with JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.