Hi Anil, You're setting the region of the chart to Italy in your options, but your data is all in India. Your issues should be fixed by setting the region option to 'IN' instead of 'IT'. Here's a working example of your code (minus the AJAX call) with your data: http://jsfiddle.net/n8zksu9c/1/
On Fri, Sep 18, 2015 at 12:16 PM Anil Kumar <[email protected]> wrote: > Hi, > I am new to Google charts. > I'm using Geo Chart with data from backend. I cannot see any error logged > and chart is not drawn. > Please tell me where am I doing wrong. > Thanks In Advance. > > I'm following the example given here. > https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=en > . > The data given is in this format > > var data = google.visualization.arrayToDataTable([ > ['City', 'Population', 'Area'], > ['Rome', 2761477, 1285.31]]) > > > I'm giving data in similar pattern to the data variable. but can't see the > chart. > > var arr=[]; > > $.ajax({ > type: 'POST', > url: "LiveMap", > dataType: "json", > success: function (response) { > > for (var i = 0; i < response.length; i++) { > var temp=[]; > var str=response[i].split(':'); > temp[0]=str[0]; > temp[1]=parseInt(str[1]); > temp[2]=parseInt(str[2]); > > arr[i]=temp; > } > } > > }); > > google.load('visualization', '1', {'packages': ['geochart']}); > google.setOnLoadCallback(drawMarkersMap); > > function drawMarkersMap() { > var data = new google.visualization.DataTable(); > data.addColumn("string","City"); > data.addColumn("number","Population"); > data.addColumn("number","Area"); > data.addRows(arr); > var options = { > region: 'IT', > displayMode: 'markers', > colorAxis: {colors: ['green', 'blue']} > }; > > var chart = new > google.visualization.GeoChart(document.getElementById('chart_div')); > chart.draw(data, options); > }; > </script> > </head> > <body> > <div id="chart_div" style="width: 300px; height: 300px;"></div> > </body> > </html> > > > The response to ajax call is > > result.put("Bhopal:300:200"); > result.put("Hyderabad:300:200"); > result.put("Vizag:300:200"); > result.put("Mysore:300:200"); > result.put("Delhi:300:200") > > ; > > -- > You received this message because you are subscribed to the Google Groups > "Google Chart 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-chart-api. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Chart 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-chart-api. For more options, visit https://groups.google.com/d/optout.
