I have a chart on my page:
<div id="list_active_value_card_accounts_table" class="graph"></div>
<script type="text/javascript">
function requestListActiveValueCardAccounts() {
var chartHolder = $('#list_active_value_card_accounts_table');
$.ajax({
url: '@Url.Content("~/endpoint/
ListActiveValueCardAccounts")',
dataType: 'json',
data: { limit: 10 },
cache: false,
success: function (result) {
var data = new google.visualization.DataTable(result);
var table = new
google.visualization.Table(chartHolder[0]);
table.draw(data, { showRowNumber: false,
cssClassNames: { tableCell: 'tablefontclass', headerCell:
'tablefontclass'} });
}
});
}
</script>
my Json:
{"cols":[{"id":"Debit","label":"Debit","type":"number"},
{"id":"Credit","label":"Credit","type":"number"},
{"id":"Balance","label":"Balance","type":"number"},
{"id":"ValueCard","label":"ValueCard","type":"string"},
{"id":"CallDate","label":"CallDate","type":"datetime"}],"rows":[{"c":
[{"v":6.75},{"v":20},{"v":13.25},{"v":"280210753455"},{"v": "new
Date(2011,11,19,8,9,13)"}]}]}
The chart fails to show because of Jquery already parsing the dates
into javascript date time, before it is handled by the datatable. The
error I get from jquery is: Object doesn't support property or method
'getTimezoneOffset' and the chart isn't drawn. This appears to be the
same issue these people are getting:
http://www.ram-solutions.nl/?tag=google-charts-api
http://stackoverflow.com/questions/2823478/populate-google-visualization-datatable-for-a-annotatedtimeline-using-json
Nothing I do seems to fix the issue, has anyone else come across this
or know how to fix it?
I'm using jquery-1.5.1.min.js
Thanks Heaps,
Maxus
Your right, I just removed all the jquery references and passed the
json statically to the datatable method, it now crashes in the middle
of (Corechart.I.js).
Any ideas why it would be doing that? Is there a way to get a
debugging version of the google code?
Thanks,
A
I found the issue:
if I change this: {"v": "new Date(2011,11,19,8,9,13)"} to {"v":
"Date(2011,11,19,8,9,13)"} all works fine :)
Thanks for your help!
Cheers,
M
> > strings. Are you sure it's jQuery throwing the error?- Hide quoted text -
>
> - Show quoted text -