DocRaptor Home
PDF Code Examples

Code Example: Google Charts Geo Chart

Here's a functioning code example of how to make a PDF that uses a Google Chart Geo Chart:

    <!--Load the AJAX API-->
    <script src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript">
     var data;
     var chart;

      // Load the Visualization API and the geochart package.
      google.load('visualization', '1', {'packages':['corechart','geochart']});

      // Set a callback to run when the Google Visualization API is loaded.

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create our data table.
        data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');
          ['Germany', 200],
          ['United States', 300],
          ['Brazil', 400],
          ['Canada', 500],
          ['France', 600],
          ['RU', 700]

        // Set chart options
        var options = {'width':400,

        // Instantiate and draw our chart, passing in some options.
        chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
        chart.draw(data, options);

      function markAsDone() {
        window.status = 'done';

      window.docraptorJavaScriptFinished = function() {
        return window.status == 'done';
      var renderTime = 2000;
      setTimeout(markAsDone, renderTime)
    <div id="chart_div" style="width:400; height:300"></div>

Ready to get started? Try DocRaptor for free with unlimited test documents.