Google visualization code is throwing a crypic error -


i'm getting data google analytics , trying display in table. code throwing error "this.zf[a].c undefined". don't see wrong code.

/*table */ google.load('visualization', '1.0', {packages:['table']}); // set callback run when google visualization api loaded. google.setonloadcallback(drawnewtable); function drawnewtable() { var json = {cols: [{id:'campaign',label:'campaign',type:'string'},{id:'source',label:'source',type:'string'},{id:'medium',label:'medium',type:'string'},{id:'sessions',label:'sessions',type:'number'}],rows:[["fac 2005-74 addresses contractor past performance reporting, contractor compensation","todays_acquisition_news_05302014","email",8.0],["gao sustains protest, finding agency revised requirements","todays_acquisition_news_05292014","email",8.0],["gsa announces oasis awards","todays_acquisition_news_05202014","email",6.0],["governance key program success","todays_acquisition_news_05192014","email",6.0],["revised fac-c addresses competency gaps, uniform standards","todays_acquisition_news_05192014","email",4.0],["far change boost small business subcontracting, advocates say","todays_acquisition_news_05272014","email",3.0],["gao examines sequestration?s effects","todays_acquisition_news_05292014","email",3.0],["gsa oig finds pbs should have notified congress when supplementing recovery act funding.","todays_acquisition_news_04282014","email",3.0],["rung leave gsa omb.","todays_acquisition_news_05152014","email",3.0],["air force may consider partnership develop new launch rocket","todays_acquisition_news_05222014","email",2.0],["boeing subcontractor pleads guilty in bribery scheme.","todays_acquisition_news_05142014","email",2.0],["commentary questions whether contracting officers using far part 1 authorities.","todays_acquisition_news_05302014","email",2.0],["contractor improperly charged labor rates, dod oig finds","todays_acquisition_news_05212014","email",2.0],["digital service team agencies address gaps","todays_acquisition_news_05272014","email",2.0],["senate hearing addresses dod's acquisition reform efforts.","todays_acquisition_news_05012014","email",2.0],["poll","todays_acquisition_news_05302014","email",2.0],["administration threatens veto of fy2015 defense authorization act","todays_acquisition_news_05202014","email",1.0],["administration threatens veto of fy2015 defense authorization act-readmore","todays_acquisition_news_05202014","text-email",1.0],["agencies have bolstered suspension , debarment programs","todays_acquisition_news_05222014","email",1.0],["air force asking industry reduce supply chain costs, official says.","todays_acquisition_news_04182014","email",1.0]]} var data_newtable = new google.visualization.datatable(json); var data_table = new google.visualization.table(document.getelementbyid('emailtable_div')); data_table.draw(data_newtable, null); }; 

format of json file wrong (cols, id... should strings...). should changed like:

var json = {     'cols': [         {'id': 'campaign', 'label':'campaign',  'type':'string'},         {'id':'source',    'label':'source',    'type':'string'},         {'id':'medium',    'label':'medium',    'type':'string'},         {'id':'sessions',  'label':'sessions',  'type':'number'}     ],     'rows':         [{ 'c':[{ 'v': "fac 2005-74 addresses contractor past performance reporting, contractor compensation"}, {'v': "todays_acquisition_news_05302014"}, {'v': "email"},{'v': 8.0}]}] } 

update: can use addcolumn() , addrow() without json changes:

var data_newtable = new google.visualization.datatable();  (var = 0; < json.cols.length; ++i) {     data_newtable.addcolumn(json.cols[i].type, json.cols[i].label, json.cols[i].id); }  (var = 0; < json.rows.length; ++i) {     data_newtable.addrow(json.rows[i]); } 

see example @ jsbin.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -