javascript - "Row given with size different than 3" Google Charts -


i'm using google charts inside of system called klipfolio. been tinkering days. curious if else has tried same. issues isn't particular kipfolio figured little bit of background may go long way.

this code:

var _component = this; var _datamodel = this.datamodel; var thearray = $.map(_datamodel, function(value, index) {  return [value]; }); var thearrays = ('['+thearray.tostring()+']'); var datadone = (json.parse(thearrays)); console.table(datadone); google.setonloadcallback(drawchart);  function drawchart() {  var data = new google.visualization.datatable(); data.addcolumn('string', 'from'); data.addcolumn('string', 'to'); data.addcolumn('number', 'weight');  data.addrows([datadone]);      // sets chart options.     var options = {     sankey: {         iterations: 700,         node: {             label: {                 fontname: 'arial',                 fontsize: 12,                 color: 'rgb(74,74,74)',                 bold: true,                 italic: false             },             interactivity: true, // allows select nodes.             labelpadding: 3, // horizontal distance between label , node.             nodepadding: 20, // vertical distance between nodes.             width: 10, // thickness of node.             colors: [                 'rgb(82,144,233)', // custom color palette sankey nodes.             'rgb(113,179,124)', // nodes cycle through palette             'rgb(206,226,55)', // giving each node own color.             'rgb(239,209,64)',                 'rgb(236,147,47)',                 'rgb(225,77,87)',                 'rgb(150,89,148)',                 'rgb(157,121,82)',                 'rgb(154,146,137)']         }     }   };      // instantiates , draws our chart, passing in options.     var chart = new google.visualization.sankey(document.getelementbyid('sankey_basic'));     chart.draw(data, options);   } 

the _datamodel variable outputs in console.table this: http://imgur.com/hqd9v2w.

the thearray variable outputs in console.table this: http://imgur.com/tfwkkfq

when chart renders, throws error:

uncaught error: row given size different 3 (the number of columns in table)

are there other steps should take eliminate error? i'm new using javascript , objects/arrays. see thearray variable has 4 columns appear, issue?

looks issue adding brackets on data.addrows function. instead of:

data.addrows([datadone]); 

which didn't generate, replaced with:

data.addrows(datadone); 

thanks henrik pointing me @ data source. once verified formation, able identify issue , fix it. chart looks great now!


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -