How to debug a chart that isn't working

42 views
Skip to first unread message

Tim Ogilvie

unread,
Jan 23, 2013, 12:30:00 PM1/23/13
to google-visua...@googlegroups.com
I'm trying to debug a LineChart that isn't displaying. Is there an easy way to understand why the Visualization API is rejecting the call? I'm just getting a blank div and would like more verbose output. Alternatively, can I paste JSON somewhere to see the results? 

I've got JSON that looks like this: 
{"rows":[{"c":[{"v":"Date(2013,0,15,20,50,25)"},{"v":12}]},{"c":[{"v":"Date(2013,0,23,2,0,14)"},{"v":16}]}],"cols":[{"type":"datetime","id":"timestamp","label":"Date"},{"type":"number","id":"rank","label":"Rank"}]}

This is valid JSON, but I'm concerned about two things: 
1) Rows appearing before columns. While the spec doesn't seem to require this, seems like it could be a problem. 
2) Date Format. I've seen some comments online that the date format gets cranky, but this seems to be ok when I compared against the docs.

Any other thoughts would be great!
Thanks
Tim

Sergey Grabkovsky

unread,
Jan 23, 2013, 12:46:42 PM1/23/13
to google-visua...@googlegroups.com

On Wed, Jan 23, 2013 at 12:30 PM, Tim Ogilvie <m...@timogilvie.com> wrote:
{"rows":[{"c":[{"v":"Date(2013,0,15,20,50,25)"},{"v":12}]},{"c":[{"v":"Date(2013,0,23,2,0,14)"},{"v":16}]}],"cols":[{"type":"datetime","id":"timestamp","label":"Date"},{"type":"number","id":"rank","label":"Rank"}]}

Hi Tim,

To address your concerns:
1) This will not be an issue, since the string will be decoded to a JavaScript object, where order doesn't matter.
2) This may be an issue, however the test data that you gave me seems to render just fine.

Perhaps you can share some data that makes the LineChart fail with me?

- Sergey

asgallant

unread,
Jan 23, 2013, 12:51:50 PM1/23/13
to google-visua...@googlegroups.com
There's nothing wrong with your JSON, see an example here: http://jsfiddle.net/asgallant/tbjSn/.  Personally, I like to use Chrome for debugging.  Open the page in Chrome and open the developer's console (ctrl+shift+j); javascript errors will print there.  Also, if you'd like, I'll help you debug your code; just post it here (or put it in a jsfiddle) and I'll take a look for you.
Reply all
Reply to author
Forward
0 new messages