title: Resize Canvas in GWT having a d3 svg in the div
body: <p>I am drawing 4 d3 line charts in the canvas category layer and I have a canvas and div list for categories as below </p>
  
  <pre><code>private ArrayList&lt;Canvas&gt; catCanvasList;
  private ArrayList&lt;Element&gt; catDivList;
  private int categoryCount = 0;
  VLayout categoryLayer;
  
  catCanvasList = new ArrayList&lt;Canvas&gt;();
  catDivList = new ArrayList&lt;Element&gt;();
  categoryCount = data.getCategories().size();
  
  for (int i = 0; i &lt; categoryCount; i++) {
      Canvas cat = new Canvas();
      cat.setWidth100();
      cat.setHeight100();
      categoryLayer.addMember(cat);
      catCanvasList.add(cat);
  }
  
  
  int a= 0;
  
  for( final String key: data.getCategories()){
  
     final Canvas c = catCanvasList.get(a);
     final Element div = DOM.createDiv();
     catDivList.add(div);
  
     createD3Vis(div,key,data);
     a++
  }
  </code></pre>
  
  <p>On window resize I redarw the d3 vis in the following way </p>
  
  <pre><code> categoryLayer.addResizedHandler(new ResizedHandler() {
  
              @Override
              public void onResized(ResizedEvent event) {
  
                  if (!catDivList.isEmpty() &amp;&amp; !catCanvasList.isEmpty()) {
                      for (Element div : catDivList) {
                          div.removeFromParent(); 
                      }
  
                      catDivList.clear();
  
                      for(final Canvas c:catCanvasList){
                          c.getDOM().removeAllChildren();
                      }
                  }
  
  
  
  int a= 0;
  
     for( final String key: data.getCategories()){
  
     final Canvas c = catCanvasList.get(a);
     final Element div = DOM.createDiv();
     catDivList.add(div);
  
     createD3Vis(div,key,data);
     a++
  }
  }
  });
  </code></pre>
  
  <p>But the above mentioned way does not work on resize and does not remove the div elemets 
  properly. </p>
  
  <p>I want to resize the canvas on window resize and redraw the d3 vis with new height and width.</p>
  
  <p>Can someone point to me where I'm going wrong.</p>