Hello, charts cannot currently be rendered straight from json data, so you need to create a DataTable from it first. I'm not sure if your json data will fit the DataTable format, but if not, then you need to massage it so it does. You can see all the different ways of creating a DataTable in these docs<https://developers.google.com/chart/interactive/docs/reference#DataTable> .
- Sergey On Fri, Nov 16, 2012 at 11:47 AM, jdv590 <[email protected]> wrote: > I am trying to fill a line chart with JSON data via ajax from an asp.netweb > service. When I run my code I get an error saying: > > Object {"it then lists all my JSON formatted data"} has no method >> 'getColumnType'. > > > > I have attached a snapshot of the error message, as well as a text file > with the JSON data. My code is below: > > <script type='text/javascript' src='https://www.google.com/jsapi >> '></script> >> <script type="text/javascript"> >> >> google.load("visualization", "1", { packages: ["corechart"] >> }); >> google.setOnLoadCallback(drawChart); >> // $(document).ready(function () { >> function drawChart() { >> var jsonData = $.ajax({ >> url: "WebService.asmx/HelloWorld", >> data: "{}", >> contentType: "application/json; charset=utf-8", >> dataType: "json", >> async: false >> }).responseText; >> var options = { >> title: 'Company Performance' >> }; >> var chart = new >> google.visualization.LineChart(document.getElementById('chart_div1')); >> chart.draw(jsonData, options); >> } >> >> //}); >> >> </script> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-visualization-api/-/mrciGOVClzMJ. > 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. > -- 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.
