title: Facebook/Twitter Share Button in Google chart
body: <p>I want to include social media share button(facebook, twitter etc) on google charts. The idea is to get the image of chart and share it on social.</p>
  
  <p>I am using this code on right click i can save google chart as image but I want to share that image on facbook how can I achieve this can you please give some ideas?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"&gt;&lt;/script&gt;
       &lt;div id="fb-root"&gt;&lt;/div&gt;
   &lt;script&gt;(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) return;
   js = d.createElement(s); js.id = id;
   js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&amp;version=v2.8";
   fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));&lt;/script&gt;
   &lt;script type="text/javascript"&gt;
     google.charts.load("current", {packages:['corechart']});
     google.charts.setOnLoadCallback(drawChart);
   function drawChart() {
  
    var data = google.visualization.arrayToDataTable([
      ['Element', 'Density', { role: 'style' }],
      ['Copper', 8.94, '#b87333', ],
      ['Silver', 10.49, 'silver'],
      ['Gold', 19.30, 'gold'],
      ['Platinum', 21.45, 'color: #e5e4e2' ]
    ]);
  
    var options = {
      title: "Density of Precious Metals, in g/cm^3",
      bar: {groupWidth: '95%'},
      legend: 'none',
    };
  
    var chart_div = document.getElementById('chart_div');
    var chart = new google.visualization.ColumnChart(chart_div);
  
    // Wait for the chart to finish drawing before calling the getImageURI() method.
    google.visualization.events.addListener(chart, 'ready', function () {
      chart_div.innerHTML = '&lt;img src="' + chart.getImageURI() + '"&gt;';
      console.log(chart_div.innerHTML);
    });
  
    chart.draw(data, options);
  
   }
  &lt;/script&gt;
  
    &lt;div class="fb-share-button" data-     href="https://developers.facebook.com/docs/plugins/" data-layout="button_count" data-size="small" data-mobile-iframe="true"&gt;&lt;a class="fb-xfbml-parse-ignore"   target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;amp;src=sdkpreparse"     &gt;Share&lt;/a&gt;&lt;/div&gt;
  </code></pre>