I changed the php code to write out the "Date(....)" format, and then was able 
to just pass the object created from the json string to the DataTable 
constructor.  I used the object format, {"c":[{"v":"Date(2012, 4, 14, 16, 14, 
36)"},{"v":12.6900498},{" v":null}]}.  Not sure if that was necessary, but it 
worked.

One other thing.  When I display the chart with Chrome or FF, it takes 2-3 
seconds.  With IE 8, it takes about 15 seconds.  Anything I can do to speed up 
IE?

Marc




________________________________
From: asgallant <[email protected]>
To: [email protected]
Sent: Mon, May 14, 2012 2:39:22 PM
Subject: [visualization-api] Re: Getting "Container height is zero. Expecting a 
valid height." error trying to use annotated time line

I noticed that, but usually the charts throw a different error when a column's 
values are the wrong type.  You can fix that by using a string representation 
of 
a Date object (this is unique to the Viz API as there is no "valid" JSON date 
structure), like this:

"rows":[{"c":["Date(2012, 4, 14, 16, 14, 36)",12.6900498,null]} 

Notice there is no "new" keyword, otherwise it looks like a js Date object 
inside a string.

On Monday, May 14, 2012 3:12:40 PM UTC-4, Marc wrote:
Sorry about the image not showing up.  I think it was because of my companies 
network security settings.  I also tried to do another post where I attached a 
jpeg file.  That at least gave me an obvious error, instead of striping out the 
image.
>
>
>I think I've figured out what was going on.  Since I couldn't get the 
>constructor to accept the full object that was being sent down, I wrote the 
>javascript to iterate through the object and contained arrays, and do specific 
>addRow calls.  It didn't work at first, but I at least got an error message, 
>indicating that, my first column was defined to be a datetime, but the value 
>passed in was a string.  Which it was, a string representation of a date.  So, 
>I 
>changed to doing specific setCell calls, constructing a Date object from the 
>first entry in the "c" array, and taking the actual values for the rest of the 
>entries, which seems to be working.
>
>
>Thanks for your help.
>
>
>marc
>
>
>
>On Monday, May 14, 2012 2:02:46 PM UTC-5, asgallant wrote:
>Your firebug message didn't post.
>>
>>
>>What happens when you fill the nulls with dummy data?
>>
>>
>>Come to think of it (and I'm going to facepalm myself if this is it), you 
>>might 
>>need to have each data point returned as an object, so it should be:
>>
>>
>>"rows":[{"c":[{"v":"14 May 2012 16:14:36"},{"v":12.6900498},{" v":null}]}  
>>
>>
>>On Monday, May 14, 2012 12:51:22 PM UTC-4, Marc wrote:
>>Still no joy.  I changed the php script, and got this in the response:
>>>
>>>
>>><"cols" section removed> "rows":[{"c":["14 May 2012 
>>>16:14:36",12.6900498,null]} 
>>
>>>....
>>>
>>>But still got the "No Data Available" message
>>>
>>>I don't know if it matters, but I saw something that looked a bit strange 
>>>when I 
>>>looked at the DataTable object with Firebug right after the constructor was 
>>>called:
>>>
>>>
>>>
>>>
>>>Not really sure where the subscripts are coming from( 0, 1, 10, 2, 3, etc ). 
>>>They aren't in the json string.  In case it wasn't painfully obvious, I'm 
>>>new at 
>>>
>>>this.
>>>
>>>
>>>On Monday, May 14, 2012 11:01:36 AM UTC-5, asgallant wrote:
>>>Use null instead of an empty braces, ie:
>>>>
>>>>
>>>>"rows": [
>>>>        {
>>>>            "c": [
>>>>                "14 May 2012 14:48:07",
>>>>                12.6900498,
>>>>                null
>>>>            ]
>>>>        }, 
>>>>.....
>>>>
>>>>On Monday, May 14, 2012 11:07:07 AM UTC-4, Marc wrote:
>>>>Thanks for the quick reply.
>>>>>
>>>>>The good news is that, making the change you suggested eliminated that 
>>>problem.
>>>>>
>>>>>The bad news is, now I have another problem.  :( 
>>>>>
>>>>>Now I'm getting a "No Data Available" message.  I'm thinking the json 
>>>>>string I'm 
>>>>>sending from my php script is not correct. 
>>>>>
>>>>>
>>>>>Here's the raw string( I've got a limited subset coming from the server 
>>>>>for 
>>>>>testing.  Normally, there would be thousands ):
>>>>>{"cols":[{"type":"datetime"},{ "type":"number","label":"1268" 
>>>>>},{"type":"number","label":" 1213"}],"rows":[{"c":["14 May 2012 
>>>>>14:48:07",12.6900498,{}]},{"c" :["14 May 2012 
>>>>>14:48:15",{},19.2097511]},{"c" 
>>>>>:["14 May 2012 14:48:18",0.802081,{}]},{"c":[ "14 May 2012 
>>>>>14:48:26",{},0.7648078]},{"c": ["14 May 2012 
>>>>>14:48:29",0.7456392,{}]},{"c": ["14 
>>>>>May 2012 14:48:37",{},0.6042936]},{"c": ["14 May 2012 
>>>>>14:48:40",0.6983837,{}]},{"c": ["14 May 2012 
>>>>>14:48:42",{},0.8682235]},{"c": ["14 
>>>>>May 2012 14:48:42",0.8991349,{}]},{"c": ["14 May 2012 
>>>>>14:48:47",{},0.727205]},{"c":[ "14 May 2012 14:48:50",0.6937866,{}]}]}
>>>>>
>>>>>Here's a segment after I run it through jsonlint.com:
>>>>>{
>>>>>< "cols" deleted>
>>>>>    "rows": [
>>>>>        {
>>>>>            "c": [
>>>>>                "14 May 2012 14:48:07",
>>>>>                12.6900498,
>>>>>                {}
>>>>>            ]
>>>>>        },
>>>>>< remainder of "rows" deleted>   
>>>>>        }
>>>>>    ]
>>>>>}
>>>>>
>>>>>I suspect the issue is how I represent a missing value.  In the JSON 
>>>>>string, you 
>>>>>can see the ",{},".  In the documentation for DataTable, the example 
>>>>>showed just 
>>>>>two commas, ",,".  However, when I tried that, and ran it past jsonlint, I 
>>>>>got a 
>>>>>syntax error at that point.
>>>>>
>>>>>
>>>>>
>>>>>On Monday, May 14, 2012 9:38:36 AM UTC-5, asgallant wrote:
>>>>>I suspect the problem is in the style attribute of your container div:
>>>>>>
>>>>>>
>>>>>><div id="chart_div" style="width: 800; height: 600"></div>  
>>>>>>
>>>>>>You are missing the 'px' after the height and width parameters.  Try it 
>>>>>>with 
>>>>>>this:
>>>>>>
>>>>>>
>>>>>><div id="chart_div" style="width: 800px; height: 600px"></div> 
>>>>>>
>>>>>>
>>>>>>
>>>>>>
-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/pqioLAbQZD0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to