google visualization formatter - no table values -


i have google.visualization datatable shows correcty values handed on data source

but if try add formatter datatable fails , not show datatable

this format of data in "datatable"

datatable=object { cols=[2], rows=[2]}

cols [object { type="string", id="description", label="description"}, object { type="number", id="1", label="1"}]

0 object { type="string", id="description", label="description"}

1 object { type="number", id="1", label="1"}

rows [object { c=[2] }]

0 object { v=59.38}

1 object { v=19.12}

this table correctly shown follows:

description | 1


first value | 59.38

second value | 19.12

this code use , produces above result ...

       var dtwrapper = new google.visualization.chartwrapper({             charttype: "table",             datatable: datatable,             options: {width: tablewidth},             containerid: tableholder         });          // here formatter inserted (before .draw)          dtwrapper.draw(); 

if insert following formatter code throws error in console:

        var formatter = new google.visualization.numberformat(               {prefix: "value: "});         formatter.format(datatable, 1); // apply formatter second column 

this error message seeing in firebug- console:

typeerror: a[da] not function

...is.n?k:t(this.n))&&0>d&&ala}}});$[h].formatvalue=function...

http://www.google.com/uds/api/visualization/1.0/4086f2e8fc632adc52e6d6795a5637a4/format+de,default,controls,corechart.i.js

line 56

here data handed on ashx-handler:

datatable =   { "cols":    [      {"type": "string" , "id": "timerange" ,"label": "timerange"},      {"type": "number" ,"id": " 2013" ,"label": " 2013" }   ],  "rows" :    [      {"c" : [               {"v": "< 15"}, {"v": 0}             ]      },      {"c" : [               {"v": "16 - 20"}, {"v": 15.63}             ]      },       {"c" : [                {"v": "21 - n"}, {"v": 15.63}             ]      },      {"c" : [               {"v": "> n"}, {"v": 68.75}             ]      }   ] }  

please can assist how solve problem ?

thanks in advance guidance don

if datatable contains "cols" , "rows" properties, not proper datatable object. @ guess, datatable this:

var datatable = {     cols: [         {type: 'string', id: 'description', label: 'description'},         {type: 'number', id: '1', label: '1'}     ],     rows: [         {c: [{v: 'first value'}, {v: 59.38}]},         {c: [{v: 'second value'}, {v: 19.12}]}     ] }; 

right? if so, need pass datatable constructor:

var data = new google.visualization.datatable(datatable); 

you can format , draw table data.

edit:

here's example fiddle shows how make work: http://jsfiddle.net/asgallant/vt4re/


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -