Hi, Has this been resolved?
 
I am having a very similar problem with the timeline visualization.  I have 
an HTML file that works.  When I try and add it to a Google app script, the 
script runs, I can see that the data is accessible, but no timeline chart 
is displayed.  When I change the Timeline chart to a Table chart, it works 
fine.  Here is my code:  I have attached an image of the output from the 
table chart:
 
I have also tried several simple examples from Google similar to the ones 
in this example and I am able to other chart types but not timelines.
 
<html>
<script type="text/javascript" src="https://www.google.com/jsapi?";></script>
<script type="text/javascript">
       google.load("visualization", '1', {packages:['corechart', 
'timeline', 'table']});
       google.setOnLoadCallback(initialize);
      function initialize() {
        // The URL of the spreadsheet to source data from.
        var query = new 
google.visualization.Query('https://docs.google.com/a/pubget.com/spreadsheets/d/1qIhxJiVQtz9hbfgDeVqRWOmaami4QZJnWt0sMkpNC_g/gviz/tq');
   query.setQuery('SELECT A, B, C, D ');   
     query.send(drawChart);
      }
      function drawChart(response) {
         var chartData = response.getDataTable();
 if (response.isError()) {
  alert('Error in query: ' + response.getMessage() + ' ' + 
response.getDetailedMessage());        
        }
        else
        { 
        alert("NUMBER OF COLUMNS: " + chartData.getNumberOfColumns() + 
"test: " + chartData.getValue(0,0));
         }  
  var container = document.getElementById('example1');
  var chart = new google.visualization.Timeline(container);
  
  var options = {
           timeline: {colorByRowLabel: true }
             };
      chart.draw(chartData);
      }
    </script>
 <div id="example1" style="align: center; width: 1000px; height: 
1000px;"></div>
</html>
 

On Wednesday, August 27, 2014 9:46:52 AM UTC-4, Mackey McCandlish wrote:

> Thanks!
>
> On Monday, August 25, 2014 4:59:58 PM UTC-7, Andrew Gallant wrote:
>>
>> Well, something is seriously messed up there.  From what I can determine, 
>> it looks like the Timeline visualization script is added to the DOM, but 
>> the contents are not getting appended to the google.visualization object as 
>> they should.  Things improve marginally if you use a ChartWrapper (the 
>> Timeline loads partially), but you run into a non-sensical error about the 
>> number of columns of data.  I'll talk to the dev team and see if I can find 
>> someone who knows more about the apps script side of things than I do.
>>
>> On Monday, August 25, 2014 10:18:46 AM UTC-4, Mackey McCandlish wrote:
>>>
>>> I added an editable version of the sheet editable version of the sheet. 
>>> <https://docs.google.com/spreadsheets/d/18gZNDg19VSfqlyqRmftkrfqqRylMDm0JSfhW8eOItNI/edit?usp=sharing>
>>>  In 
>>> that sheet you can click "tools/script editor" and see the actual source. 
>>> Currently the source is set to draw a simple bar graph, but you can swap 
>>> the comments in code.gs to make it do the nonfunctional timeline chart.
>>>
>>> To deploy the source you must make a copy of the sheet (so you are the 
>>> owner), and press the cloud shaped deploy icon in the script editor.
>>>  
>>>
>>>> Hmm, there's nothing in that sheet that tells me anything - no error 
>>>> messages, warnings, or indication that it *might* be trying to draw a 
>>>> chart, or even that it is importing an HTML file.  Can you create another 
>>>> sheet with a non-Timeline chart that works so I can see what it should be 
>>>> outputting?
>>>>
>>>> On Thursday, August 21, 2014 10:24:55 AM UTC-4, Mackey McCandlish wrote:
>>>>>
>>>>> Added shared doc with just this part:
>>>>>
>>>>> https://docs.google.com/spreadsheets/d/1OlInCobyHdrLJbtrDZ2VltD3cLYk-EsmPRywf6c-mtg/edit?usp=sharing
>>>>>
>>>>> Thanks for catching the comma. It was not a problem in earlier 
>>>>> revisions though, and it still doesn't work when I fix it. Also tried 
>>>>> adding <!DOCTYPE html>.
>>>>>
>>>>> Thanks for the assistance. 
>>>>>
>>>>> On Wednesday, August 20, 2014 5:31:31 AM UTC-7, Andrew Gallant wrote:
>>>>>>
>>>>>> The only problems I see with that file are that it is missing a 
>>>>>> <!DOCTYPE> declaration, and it has an errant comma at the end of the 
>>>>>> data 
>>>>>> array:
>>>>>>
>>>>>> var data = google.visualization.arrayToDataTable([
>>>>>>     ['Pres', 'Start', 'End'],
>>>>>>     ['2004',  new Date(1789, 3, 29),      new Date(1797, 2, 3)],
>>>>>>     ['2005',  new Date(1797, 2, 3),       new Date(1801, 2, 3)],
>>>>>>     ['2006',  new Date(1801, 2, 3),       new Date(1809, 2, 3)], <-- 
>>>>>> this comma
>>>>>> ]);
>>>>>>
>>>>>> These two issues will prevent the chart from drawing in IE8 and 
>>>>>> older, but otherwise the chart should draw fine.  Do you have a 
>>>>>> public-facing page where this is being pulled in by the HtmlService that 
>>>>>> I 
>>>>>> can test?
>>>>>>
>>>>>> On Wednesday, August 20, 2014 2:24:47 AM UTC-4, Mackey McCandlish 
>>>>>> wrote:
>>>>>>>
>>>>>>> Here is the html, it is just an example from the visualization 
>>>>>>> samples, wrapped in <html><body>.
>>>>>>>
>>>>>>> On Tuesday, August 19, 2014 4:11:40 PM UTC-7, Andrew Gallant wrote:
>>>>>>>>
>>>>>>>> Can you attach Timeline.html here?
>>>>>>>>
>>>>>>>> On Tuesday, August 19, 2014 9:49:13 AM UTC-4, Mackey McCandlish 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> doGet() returns HtmlService.createHtmlOutputFromFile('timeline'), 
>>>>>>>>> and timeline.html has the html in it. Timeline.html is another file 
>>>>>>>>> in the 
>>>>>>>>> project.
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>> On Monday, August 18, 2014 5:18:09 PM UTC-7, Andrew Gallant wrote:
>>>>>>>>>>
>>>>>>>>>> Is the chart code in the file you load through the 
>>>>>>>>>> HtmlService.createHtmlOutputFromFile call, or is it in apps script?
>>>>>>>>>>
>>>>>>>>>> On Monday, August 18, 2014 10:31:46 AM UTC-4, Mackey McCandlish 
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> I've been able to create charts in javascript and display them 
>>>>>>>>>>> from my googlescript app, by using an app that returns 
>>>>>>>>>>> HtmlService.createHtmlOutputFromFile('filename');
>>>>>>>>>>>
>>>>>>>>>>> When I try to do this with a timeline chart, nothing appears. 
>>>>>>>>>>> The script is from google's visualization example at 
>>>>>>>>>>> https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline
>>>>>>>>>>> .
>>>>>>>>>>>
>>>>>>>>>>> Is this meant to be supported?
>>>>>>>>>>>
>>>>>>>>>>> Thanks.
>>>>>>>>>>>
>>>>>>>>>>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to