Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 800237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:15:45+00:00 2026-05-14T23:15:45+00:00

I have some data and want to create some dynamic charts. I have looked

  • 0

I have some data and want to create some dynamic charts. I have looked on Google visualisation api .. It looks great but the problem is I am not very familiar with it. Any ideas, how I can set the data.setValue from mysql data.

  <script type='text/javascript'>
   google.load('visualization', '1', {'packages': ['geomap']});
   google.setOnLoadCallback(drawMap);

    function drawMap() {
      var data = new google.visualization.DataTable();
      data.addRows(6);
      data.addColumn('string', 'Country');
      data.addColumn('number', 'Popularity');
      data.setValue(0, 0, 'Germany');
      data.setValue(0, 1, 200);
      data.setValue(1, 0, 'United States');
      data.setValue(1, 1, 300);
      data.setValue(2, 0, 'Brazil');
      data.setValue(2, 1, 400);
      data.setValue(3, 0, 'Canada');
      data.setValue(3, 1, 500);
      data.setValue(4, 0, 'France');
      data.setValue(4, 1, 600);
      data.setValue(5, 0, 'RU');
      data.setValue(5, 1, 700);

      var options = {};
      options['dataMode'] = 'regions';

      var container = document.getElementById('map_canvas');
      var geomap = new google.visualization.GeoMap(container);
      geomap.draw(data, options);
  };
  </script>

I can create chart using some other methods but just interested in using Google Visualisation API.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:15:46+00:00Added an answer on May 14, 2026 at 11:15 pm

    Update:

    Have a look at how you can add data to the chart. You have the possibility to add data in JSON.

    The only thing you have to do is to prepare a corresponding PHP array. Then you can serialize this array and set the data. E.g.

    <?php 
    // $data is an array and already has the correct structure...
    $jdata = json_encode($data);
    
    ?>
    
    <!-- later ... -->
    
    <script type='text/javascript'>
       google.load('visualization', '1', {'packages': ['geomap']});
       google.setOnLoadCallback(drawMap);
    
       function drawMap() {
          var data = new google.visualization.DataTable(<?php echo $jdata ?>);
          var options = {};
          options['dataMode'] = 'regions';
    
          var container = document.getElementById('map_canvas');
          var geomap = new google.visualization.GeoMap(container);
          geomap.draw(data, options);
       };
    </script>
    

    I recommend to read the documentation / API reference. I basically found this just by searching…


    Without further information we cannot give a specific answer but a general approach is:

    Assuming that you already fetched the records from your DB in a result set $results than you can just loop over it:

    <?php foreach($results as $row): ?>
    
        data.setValue(<?php echo $row['column1']; ?>, <?php echo $row['column2']; ?>);
        // depends on what type of char you want to create, on your actual data etc.
    
    <?php endforeach; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data passed into the flex via webservices, and want to create
I have some kind of test data and want to create a unit test
In a PHP project I have some data I want to sort using a
I have some data that I want to store somewhere in my Rails app
I have some data that I want to display as a box plot using
I have some MET data I want to validate which would look something like
I have some data that has various attributes and I want to hierarchically group
I have some data generated in MATLAB that I want to process using Perl.
I have some data. I want to go through that data and change cells
I have some data stored as ArrayList . And when I want to backup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.