I am using JSON data to add rows. Following this along in Chrome I can see 
chartdata getting the 'qp' node filled with the rows from my dataset. But 
in the end I get "table has no rows". Been at this for a while and I have 
run out of options to pursue.

The dataTableToCsv result does not give me any clues either.

What am I missing here?


google.charts.load('current', { 'packages': ['annotationchart'] });
google.charts.setOnLoadCallback(drawChart);

function drawChart() {
    var chartdata = new google.visualization.DataTable();
    chartdata.addColumn('datetime', 'Date');
    chartdata.addColumn('number', 'Chan 1');
    chartdata.addColumn('number', 'Chan 4');

    $.getJSON('/Members/chartGet7010s', function (data) {
        $.each(data, function (i, item) {
            var rdDate = parseJsonDate(item.readingDate);
            chartdata.addRow([new Date(rdDate.getFullYear(), 
rdDate.getMonth(), rdDate.getDate(), rdDate.getHours(), 
rdDate.getMinutes(), rdDate.getSeconds()), parseFloat(item.Chan1), 
parseFloat(item.Chan4)]);            
        });
    });

    var chart = new 
google.visualization.AnnotationChart(document.getElementById('chart_div'));

    var csvdata = new google.visualization.dataTableToCsv(chartdata);
    console.log(csvdata);
    var options = {
        displayAnnotations: true
    };

    chart.draw(chartdata, options);
}

function parseJsonDate(jsonDateString) {
    return new Date(parseInt(jsonDateString.replace('/Date(', '')));
};

-- 
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 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/a70bd8c9-6f5b-491d-b775-7d7d654995f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to