title: how to clone and re draw google chart in another div?
body: <p>I am having a hard time to figure out how to do this, since i am not that familiar with google chart.</p>
  
  <p>I am using pivotTable.js and everything is working okay, but i want to "save" or have a button where the current created chart will be cloned to another div.</p>
  
  <p>I made a global variable</p>
  
  <pre><code>var wrapper;
  </code></pre>
  
  <p>this to save the chart</p>
  
  <pre><code> wrapper = new google.visualization.ChartWrapper({
        dataTable: dataTable,
        chartType: chartType,
        options: options
      });
      wrapper.draw(result[0]);
  </code></pre>
  
  <p>After this, when the button is clicked the wrapper chart, should be redrawn in another div.</p>
  
  <pre><code>&lt;div id="trial" style="margin: 30px;"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I tried to do this but i am stock with how will i put the chart into the trial div.</p>
  
  <pre><code>  // Never called.
        google.visualization.events.addListener(wrapper, 'onmouseover', uselessHandler);
  
  
        google.visualization.events.addListener(wrapper, 'ready', onReady);
  
  
        // Never called
        function uselessHandler() {
          alert("I am never called!");
        }
  
        function onReady() {
          google.visualization.events.addListener(wrapper.getChart(), 'click', usefulHandler);
        }
  
        // Called
        function usefulHandler() {
          alert(wrapper.getChart());
        }
  </code></pre>
  
  <p>SOLVED:</p>
  
  <pre><code>   function getChart() {
    google.visualization.events.addListener(wrapper, 'ready', onReady);
        function onReady() {
          google.visualization.events.addListener(wrapper.getChart(), 'click', usefulHandler);
        }
      var trialChart = wrapper.clone();
      trialChart.setContainerId('trial');
      trialChart.draw();
  }
  </code></pre>