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

  • SEARCH
  • Home
  • 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 7188255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:02:02+00:00 2026-05-28T19:02:02+00:00

I require my Google chart to be drawn with dynamic data, so I’m storing

  • 0

I require my Google chart to be drawn with dynamic data, so I’m storing it in a variable:

var rowData = "[ [{ v: 'Mike', f: 'Mike' }, '', 'The President'], [{ v: 'Jim', f: 'Jim Vice President' }, 'Mike', 'VP'], ['Alice', 'Mike', ''], ['Bob', 'Jim', 'Bob Sponge'], ['Carol', 'Bob', ''] ]";

I’m then passing this variable into Google’s function:

    google.load('visualization', '1', { packages: ['orgchart'] });
    //google.setOnLoadCallback(drawChart);
    function drawChart(json) {
        data = new google.visualization.DataTable();
        data.addColumn('string', 'Name');
        data.addColumn('string', 'Manager');
        data.addColumn('string', 'ToolTip');
        data.addRows([
            rowData
        ]);
        chart = new google.visualization.OrgChart(document.getElementById('orgChart'));
        chart.draw(data, { allowHtml: true });
        google.visualization.events.addListener(chart, 'select', selectHandler);
    }

However, this gives me an ‘Every row given must be either null or an array.’ error. If I remove the variable and pass the data in directly, it works fine:

    ...
    data.addRows(
        [ [{ v: 'Mike', f: 'Mike' }, '', 'The President'], [{ v: 'Jim', f: 'Jim Vice President' }, 'Mike', 'VP'], ['Alice', 'Mike', ''], ['Bob', 'Jim', 'Bob Sponge'], ['Carol', 'Bob', ''] ]
    );
    ...

Can anyone help tell me what’s going on here? Thanks in advance.

  • 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-28T19:02:04+00:00Added an answer on May 28, 2026 at 7:02 pm

    In your first example the data is a single string, in the second example your data is a JavaScript structure of arrays and individual strings / values.

    Hard to recommend a best-practice without knowing where you’re dynamic data is coming from, but you should be able to remove the outermost quotes like this and have it work:

    var rowData = [ [{ v: 'Mike', f: 'Mike' }, '', 'The President'], [{ v: 'Jim', f: 'Jim Vice President' }, 'Mike', 'VP'], ['Alice', 'Mike', ''], ['Bob', 'Jim', 'Bob Sponge'], ['Carol', 'Bob', ''] ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Google App Engine program that will require some basic spell
The format of the vertical axis of a Google Visualization Chart can be changed
Google Maps APIs require 3 parameters to start with: lat, long and zoom level.
does google charts have a library for software development that does not require internet
require 'net/http' urls = [ {'link' => 'http://www.google.com/'}, {'link' => 'http://www.facebook.com/'}, {'link' => 'http://www.yahoo.com/'}
I'm fetching some line charts using Google's Chart API and placing it in a
In a python/google app engine app, I've got a choice between storing some static
I just want to know how can I add the data type here? Google
When setting up Google Adsense or Gmail as a site owner, you are required
Mail for my domain is handled by google apps service, all required DNS MX

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.