O'Reilly logo

Mastering ArcGIS Server Development with JavaScript by Ken Doman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required