Error drawing Gantt chart when data comes from query

113 views
Skip to first unread message

Chris Hellewell

unread,
Jan 19, 2016, 11:13:49 AM1/19/16
to Google Visualization API
I am trying to draw a Gantt chart and query the Data Table from a Google Sheet. I can draw a Gantt chart successfully when I hard code the Data Table in the Javascript. When I query the Google Sheet for the Data Table, the chart.draw() function produces an error. I've looked the difference between the two Data Tables in the debugger. The only meaningful difference I can see is how null objects are represented. In the hard coded data table, fields that are null are represented by an Object with a null value. In the queried Data Table, empty fields are represented by null, there is no Object. Could this be what is causing draw.chart() to produce an error? I've attached both examples.

Chris
flex_gantt.html
sample_gantt.html

Daniel LaLiberte

unread,
Jan 19, 2016, 2:37:09 PM1/19/16
to Google Visualization API
Hi Chris,

I would guess you have found a bug.  We should be able to handle a null value or an object with 'v' property of null the same way.  So thanks for reporting this.  Not sure how soon we can get to fixing it but we'll look into it.  I don't know if there might be a workaround, such as inserting a space in empty fields.

On Tue, Jan 19, 2016 at 11:13 AM, Chris Hellewell <cthel...@gmail.com> wrote:
I am trying to draw a Gantt chart and query the Data Table from a Google Sheet. I can draw a Gantt chart successfully when I hard code the Data Table in the Javascript. When I query the Google Sheet for the Data Table, the chart.draw() function produces an error. I've looked the difference between the two Data Tables in the debugger. The only meaningful difference I can see is how null objects are represented. In the hard coded data table, fields that are null are represented by an Object with a null value. In the queried Data Table, empty fields are represented by null, there is no Object. Could this be what is causing draw.chart() to produce an error? I've attached both examples.

Chris

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/afb16269-c582-4b88-9bf4-b70e73af2066%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Chris Hellewell

unread,
Jan 21, 2016, 3:00:08 PM1/21/16
to Google Visualization API
Daniel,

Thank you for your reply. I wrote a javascript routine to loop through the DataTable and replace all the nulls with an Object with a null value, and the chart.draw() function still produced an error. I looked closer at the differences between the two DataTables and found that the Objects in the array of columns in the hard coded DataTable include the "pattern" field, which has an empty string for its value. The queried DataTable columns did not include this field. Could this be the problem? I would try looping through the columns and adding the pattern, but I can't find a method on the DataTable object that does that. If there is a way to do this and you wouldn't mind pointing it out, I will give this a try.

Chris  


On Tuesday, January 19, 2016 at 12:37:09 PM UTC-7, Daniel LaLiberte wrote:
Hi Chris,

I would guess you have found a bug.  We should be able to handle a null value or an object with 'v' property of null the same way.  So thanks for reporting this.  Not sure how soon we can get to fixing it but we'll look into it.  I don't know if there might be a workaround, such as inserting a space in empty fields.
On Tue, Jan 19, 2016 at 11:13 AM, Chris Hellewell <cthel...@gmail.com> wrote:
I am trying to draw a Gantt chart and query the Data Table from a Google Sheet. I can draw a Gantt chart successfully when I hard code the Data Table in the Javascript. When I query the Google Sheet for the Data Table, the chart.draw() function produces an error. I've looked the difference between the two Data Tables in the debugger. The only meaningful difference I can see is how null objects are represented. In the hard coded data table, fields that are null are represented by an Object with a null value. In the queried Data Table, empty fields are represented by null, there is no Object. Could this be what is causing draw.chart() to produce an error? I've attached both examples.

Chris

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--

Chris Hellewell

unread,
Jan 21, 2016, 7:16:15 PM1/21/16
to Google Visualization API
I found the problem! One of the rows in my Google Sheet was missing a comma in the list of dependencies in the Dependencies column. Doh! Thanks again for your reply. My final comment is that it would be helpful if the chart.draw() function would have provided a message as part of the error. With a proper error message I may have been able to track this down sooner. According to the documentation the message field is required, but in the error callback the message field is undefined.  

Chris

On Tuesday, January 19, 2016 at 12:37:09 PM UTC-7, Daniel LaLiberte wrote:
Hi Chris,

I would guess you have found a bug.  We should be able to handle a null value or an object with 'v' property of null the same way.  So thanks for reporting this.  Not sure how soon we can get to fixing it but we'll look into it.  I don't know if there might be a workaround, such as inserting a space in empty fields.
On Tue, Jan 19, 2016 at 11:13 AM, Chris Hellewell <cthel...@gmail.com> wrote:
I am trying to draw a Gantt chart and query the Data Table from a Google Sheet. I can draw a Gantt chart successfully when I hard code the Data Table in the Javascript. When I query the Google Sheet for the Data Table, the chart.draw() function produces an error. I've looked the difference between the two Data Tables in the debugger. The only meaningful difference I can see is how null objects are represented. In the hard coded data table, fields that are null are represented by an Object with a null value. In the queried Data Table, empty fields are represented by null, there is no Object. Could this be what is causing draw.chart() to produce an error? I've attached both examples.

Chris

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.



--

Daniel LaLiberte

unread,
Jan 21, 2016, 9:57:00 PM1/21/16
to Google Visualization API
Glad you found the problem.  I'd agree that we should try to provide a more informative error message for this situation.

On Thu, Jan 21, 2016 at 7:16 PM, Chris Hellewell <cthel...@gmail.com> wrote:
I found the problem! One of the rows in my Google Sheet was missing a comma in the list of dependencies in the Dependencies column. Doh! Thanks again for your reply. My final comment is that it would be helpful if the chart.draw() function would have provided a message as part of the error. With a proper error message I may have been able to track this down sooner. According to the documentation the message field is required, but in the error callback the message field is undefined.  

Chris

On Tuesday, January 19, 2016 at 12:37:09 PM UTC-7, Daniel LaLiberte wrote:
Hi Chris,

I would guess you have found a bug.  We should be able to handle a null value or an object with 'v' property of null the same way.  So thanks for reporting this.  Not sure how soon we can get to fixing it but we'll look into it.  I don't know if there might be a workaround, such as inserting a space in empty fields.
On Tue, Jan 19, 2016 at 11:13 AM, Chris Hellewell <cthel...@gmail.com> wrote:
I am trying to draw a Gantt chart and query the Data Table from a Google Sheet. I can draw a Gantt chart successfully when I hard code the Data Table in the Javascript. When I query the Google Sheet for the Data Table, the chart.draw() function produces an error. I've looked the difference between the two Data Tables in the debugger. The only meaningful difference I can see is how null objects are represented. In the hard coded data table, fields that are null are represented by an Object with a null value. In the queried Data Table, empty fields are represented by null, there is no Object. Could this be what is causing draw.chart() to produce an error? I've attached both examples.

Chris

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.



--

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages