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 5843913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:13:13+00:00 2026-05-22T12:13:13+00:00

I am roughly following this example . But must be doing something silly… The

  • 0

I am roughly following this example. But must be doing something silly…

The server side Django view code:

data_table = gviz_api.DataTable(description)
data_table.LoadData(data)
json = data_table.ToJSon()
return json

These are the values of the variables copy-pasted from the pydev debugger: (Im using strings for each description field type just for testing)

description:

[("sensor","string", "Sensor name"), 
 ("timestamp","string", "Time"),
 ("value","string", "Sensor value")]

data:

[['testsensor', '2011-05-09 16:06:43.936000', '22.0'],
['testsensor', '2011-05-09 16:56:23.367000', '23.0']]

json (generated by the google api):

{cols:[{id:'sensor',label:'Sensor name',type:'string'},{id:'timestamp',label:'Time',type:'string'},{id:'value',label:'Sensor value',type:'string'}],rows:[{c:[{v:'testsensor'},{v:'2011-05-09 16:06:43.936000'},{v:'22.0'}]},{c:[{v:'testsensor'},{v:'2011-05-09 16:56:23.367000'},{v:'23.0'}]}]}

The client side javascript code that receives the json:

var json_table = new google.visualization.Table(document.getElementById('dataview'));
var json_data = new google.visualization.DataTable(data, 0.6);
json_table.draw(json_data, {showRowNumber: true});

This causes the following error on constructing the DataTable object (second line):

Uncaught Error: Invalid JSON string: {cols:[{id:'sensor',label:'Sensor name',type:'string'},{id:'timestamp',label:'Time',type:'string'},{id:'value',label:'Sensor value',type:'string'}],rows:[{c:[{v:'testsensor'},{v:'2011-05-09 16:06:43.936000'},{v:'22.0'}]},{c:[{v:'testsensor'},{v:'2011-05-09 16:56:23.367000'},{v:'23.0'}]}]}
in default,table.I.js:152

I understood that the whole clue was making sure that the schema format matches the data format but this seems to be the case. It must be something simple.

  • 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-22T12:13:14+00:00Added an answer on May 22, 2026 at 12:13 pm

    Unfortunately I can’t comment so this isn’t exactly a full answer, but could you try eval’ing the JSON before trying to use it for the chart?

    var json_table = new google.visualization.Table(document.getElementById('dataview'));
    var evalledData = eval("("+data+")");
    var json_data = new google.visualization.DataTable(evalledData, 0.6);
    json_table.draw(json_data, {showRowNumber: true});
    

    I think that may have solved this problem for me in the past; it may not be the safest way to go about it, but you could at least try it for testing.

    Alternatively, perhaps play with simplejson to dump your json string from the python instead of just returning the gviz string?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have roughly the following code. Could this be made nicer or more efficient?
I have html code that looks roughly like this: <div id=id1> <div id=id2> <p>some
I've got HTML code that roughly looks like this: <li id=someid-11> <img src=... alt=alt
The codebase at work contains some code that looks roughly like this: #define DATA_LENGTH
I've set up a Rails form roughly following the instructions in this Railscast. Here's
I would like to do something roughly analogous (but not exactly identical) to the
I've been trying to get OpenGL-ES to do something roughly like the following to
A GWT tree looks roughly like this: <div class=gwt-Tree> <div style=padding-top: 3px; padding-right: 3px;
I have roughly 12 computers that each have the same script on them. This
I have a structure that roughly looks like this: List<ProductLine> -> ID Name ...

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.