It's not clear why your code would work the first time, but in your call of
google.setOnLoadCallback, you must give it a function rather than call a
function (such as your drawChart call). So your daysRequested would have
to be passed to drawChart another way. Here is one possibility.
google.setOnLoadCallback(function() { drawChart(3) });
dan
On Tue, Oct 22, 2013 at 2:03 PM, dreamn11 <[email protected]> wrote:
> First load everythign works, if I refresh the page I get this error
>
> Uncaught TypeError: Cannot read property 'DataTable' of undefined
>
> google.load("visualization", "1", { packages: ["table", "corechart"] });
> google.setOnLoadCallback(drawChart(3)); function drawChart(daysRequested) {
> $.get('http://localhost/api/Metrics/GetData', { days: daysRequested },
> function(d) { var data = new google.visualization.DataTable(d); //var
> formatter_short = new google.visualization.DateFormat({ formatType: 'short'
> }); var formatter_short = new google.visualization.DateFormat({ pattern:
> 'MM/dd/yyyy' }); formatter_short.format(data, 0); //var options = { width:
> "650px" } var chart = new
> google.visualization.Table(document.getElementById('table_div'));
> chart.draw(data, { cssClassNames: { headerRow: 'bigAndBoldClass',
> tableCell: 'tdCell', hoverTableRow: 'hoverClass' } }); }); }
>
> --
> 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/groups/opt_out.
>
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> -
978-394-1058
[email protected] <[email protected]> 562D 5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA
--
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/groups/opt_out.