I can't seem to have multiple Annotated Timelines on the same page.
Both timelines use the same code (as seen below) to format a JSON
response from my server into a DataTable. The problem is that upon
loading the page, only the first Annotated Timeline appears, and the
other doesn't give any error. I know this is valid data because if I
make both timelines read from the same JSON source, only the first one
appears.

=========================

google.load('visualization', '1', {'packages':['piechart',
'corechart', 'geomap', 'annotatedtimeline']});
google.setOnLoadCallback(function() {drawCharts("data.php");});

function drawCharts(url) {
        $.getJSON(url+"&d=purchases", function(data) {
                var i=0; for(row in data) i++;
                var PurchasesData = new google.visualization.DataTable();
                PurchasesData.addColumn('datetime', 'Date');
                PurchasesData.addColumn('number', 'Purchases');
                PurchasesData.addRows(i);
                var i = 0;
                for(row in data) {
                   PurchasesData.setValue(i, 0, new Date(data[row][0]));
                   PurchasesData.setValue(i, 1, data[row][1]);
                   i++;
                }  alert(PurchasesData.toJSON());
                var test2 = new
google.visualization.AnnotatedTimeLine(document.getElementById('purchases')).draw(PurchasesData,
{displayZoomButtons: false});
         });

        $.getJSON(url+"&d=views", function(data) {
                var i=0; for(row in data) i++;
                var ViewsData = new google.visualization.DataTable();
                ViewsData.addColumn('datetime', 'Date');
                ViewsData.addColumn('number', 'Views');
                ViewsData.addRows(i);
                var i = 0;
                for(row in data) {
                   ViewsData.setValue(i, 0, new Date(data[row][0]));
                   ViewsData.setValue(i, 1, data[row][1]);
                   i++;
                }
                var test = new
google.visualization.AnnotatedTimeLine(document.getElementById('views')).draw(ViewsData,
{displayZoomButtons: false});
         });
}

====================

Any ideas? Is this a bug?

-- 
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