define("analysis.visualizer",["http://www.google.com/jsapi/"],function(){function a(){console.debug("analysis.visualizer","googleVisualizationReady")}function b(a){var b={raleigh:"Raleigh",port:"New Port","new":"Wilmington",west:"West River",lake:"Lake",south:"South Raleigh",north:"North Raleigh",est:"Eastern",east:"East Brook",wilfred:"Wilfred",zena:"Durham",en_us:"English",twitter:"Twitter",facebook:"Facebook",male:"Male",female:"Female"};return b[a]||a}function c(a,b){console.debug("Pie");var c=google.visualization.arrayToDataTable(b),d=jQuery('<div class="result-piegraph"></div>');return jQuery(".query-result").append(d),new google.visualization.PieChart(d.get(0)).draw(c,{title:a}),g[a]={title:a,element:d},f}function d(a,b){console.debug("Map");var c=google.visualization.arrayToDataTable(b.raw),d=jQuery('<div class="result-map"></div>');return jQuery(".query-result").append(d),new google.visualization.GeoChart(d.get(0)).draw(c,{region:"US",displayMode:"regions",resolution:"provinces",enableRegionInteractivity:!0}),g[a]={title:a,element:d},f}function e(a,c){console.debug("Table",c);var d=new google.visualization.DataTable,e=c.total,h=c.terms||[];d.addColumn("string","Metric"),d.addColumn("number","Percentage"),d.addColumn("number","Count"),h.forEach(function(a){d.addRows([[b(a.term),{v:Math.round(a.count/e*100),f:Math.round(a.count/e*100)+"%"},{v:a.count}]])});var i=jQuery('<div class="result-table"></div>');return jQuery(".query-result").append(i),new google.visualization.Table(i.get(0)).draw(d,{showRowNumber:!1,pageSize:5}),g[a]={title:a,element:i},f}console.debug("analysis.visualizer"),google.load("visualization","1",{packages:["geochart","corechart","table"],callback:a});var f=this,g={};return{Map:d,Table:e,Pie:c,_cached:g}});