title: Using d3 script in GWT application using JSNI
body: <p>I am trying to integrate a d3 script into gwt web-app. However I cannot figure it out how to run the d3 from JSNI. The d3 code works well separately; I am wondering it may be because the d3 code cannot access the div element? 
  <br> This is the approach I am following:<br>
  + add the 'script' tags in the main html file head, to specify the d3 libraries<br>
  + Put the following d3 code in a method, using JSNI, and call the method in onModuleLoad(). the d3 code accesses the main div element, which the rootPanel is also using.</p>
  
  <pre><code>/*-{
  
      var w = 960, h = 800;
      var svg = d3.select("#chart2")
          .append("svg:svg")
          .attr("width", w)
          .attr("height", h)
          .append("svg:g")
          .attr("transform", "translate(40, 0)");
  
          svg.selectAll("circle")
              .data([ 32, 57, 112, 293 ])
              .enter()
              .append("circle")
              .attr("cy", 90)
              .attr("cx", String)
              .attr("r", Math.sqrt);
  
  }-*/; 
  </code></pre>
  
  <p>I also tried another approach; I added another div element inside a HTML element in the Java class, and tried to access the second div from the d3.</p>
  
  <p>In both cases nothing is showing up. any idea how it might work please?</p>