asp.net mvc 4 - google is not defined in mvc4 -


i trying render google geochart inside partial view in mvc4 it's showing reference error: "google not defined"

but in simple view it's rendering fine.below step render geochat.i don't know doing wrong or should fellow other step render google geochat.

my partial view(_mymap.cshtml)

     <script type='text/javascript' src='http://www.google.com/jsapi'></script>         <div id='visualization'></div>         <script type='text/javascript'>                      function initialize() {                         google.load('visualization', '1', { 'packages': ['geochart'] });                         google.setonloadcallback(drawvisualization);                     }           function drawvisualization() {                         var data = new google.visualization.datatable();                          data.addcolumn('string', 'country');                         data.addcolumn('number', 'value');                         data.addcolumn({ type: 'string', role: 'tooltip' }); var ivalue = new array();                          data.addrows([[{ v: '002', f: 'africa' }, 0, 'click choose']]);                         ivalue['002'] = 'http://en.wikipedia.org/wiki/africa';                          data.addrows([[{ v: '150', f: 'europe' }, 1, 'click choose']]);                         ivalue['150'] = 'http://en.wikipedia.org/wiki/europe';                          data.addrows([[{ v: '019', f: 'americas' }, 2, 'click choose']]);                         ivalue['019'] = 'http://en.wikipedia.org/wiki/americas';                          data.addrows([[{ v: '142', f: 'asia' }, 3, 'click choose']]);                         ivalue['142'] = 'http://en.wikipedia.org/wiki/asia';                          data.addrows([[{ v: '009', f: 'australia' }, 4, 'click choose']]);                         ivalue['009'] = 'http://en.wikipedia.org/wiki/oceania';                          var options = {                             backgroundcolor: { fill: '#ffffff', stroke: '#ffffff', strokewidth: 0 },                             coloraxis: { minvalue: 0, maxvalue: 4, colors: ['#a8a8a8', '#939473', '#b1b38b', '#90ad89', '#87aaad', ] },                             legend: 'none',                             backgroundcolor: { fill: '#ffffff', stroke: '#ffffff', strokewidth: 0 },                             datalessregioncolor: '#f5f5f5',                             displaymode: 'regions',                             enableregioninteractivity: 'true',                             resolution: 'continents',                             sizeaxis: { minvalue: 1, maxvalue: 1, minsize: 10, maxsize: 10 },                             region: 'world',                             keepaspectratio: true,                             width: 600,                             height: 400,                             tooltip: { textstyle: { color: '#444444' }, trigger: 'focus' }                         };                         var chart = new google.visualization.geochart(document.getelementbyid('visualization'));                          google.visualization.events.addlistener(chart, 'select', function () {                             var selection = chart.getselection();                             //append_to_list(data.getvalue(selection[0].row, 0));                         });                           chart.draw(data, options); }     $(document).ready(function () {initialize();});     </script> 

drawvisualization function missing closing brace inside script tag. have closed after end script tag in code.

$(document).ready(function () {initialize();}); </script>                  } //this brace need inside script tag 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -