Your data for dates in string format has a couple problems. You start your numbers with 0, which looks like octal. You have a trailing space in the string, so it is not recognized as a string formatted date. You may also be assuming your months start with index 1, which is incorrect since they should start with 0 for January.
See: http://jsfiddle.net/dlaliberte/g1cxenea/ On Thu, Apr 9, 2015 at 6:20 AM, mariummalik22 <[email protected]> wrote: > My JSON data is:{ "cols": > [{"id":"","label":"Date2","pattern":"","type":"number"}, > {"id":"","label":"OK Count","pattern":"","type":"date"} ], "rows": [ > {"c":[{"v": 2 ,"f": null},{"v": "Date(2015,04,09) ","f": null }]}, > {"c":[{"v": 10 ,"f": null},{"v": "Date(2015,04,10) ","f": null }]}, > {"c":[{"v": 4 ,"f": null},{"v": "Date(2015,04,11) ","f": null }]}, > {"c":[{"v": 4 ,"f": null}, {"v": "Date(2015,04,20)","f": null }]} ] } > > Part of my script is: > <!--Load the AJAX API--> > <script type="text/javascript" src="http://www.google.com/jsapi > "></script> > <script type="text/javascript" src="jquery-1.9.1.min.js"></script> > <script type="text/javascript"> > > // Load the Visualization API and the piechart,table package. > google.load('visualization', '1', {'packages':['corechart']}); > > function drawItems(num) { > var jsonPieChartData = $.ajax({ > url: "getdata.php", > data: "q="+num, > dataType:"json", > async: false > }).responseText; > > > > // Create our data table out of JSON data loaded from server. > var piechartdata = new > google.visualization.DataTable(jsonPieChartData); > > // Instantiate and draw our pie chart, passing in some options. > var chart = new > google.visualization.LineChart(document.getElementById('chart_div')); > chart.draw(piechartdata, { > width: 800, > height: 600, > pointSize:5, > chartArea: { left:"10%",top:"10%",width:"80%",height:"80%" }, > legend: {position:'top'}, > hAxis: { > title: "Date1" > > } > > }); > > > } > > I don't think so that there is any error in it. But it gives error > "Undefined is not a function" all the time. What could be the reason of it? > > -- > 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. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 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/d/optout.
