javascript - Errors with data from array in d3 -


i'm relatively new d3 , i'm having trouble loading csv. found example using txt file i've set im still having issues using data in d3 change height of rect. when use error:

uncaught typeerror: cannot read property '1' of undefined

$(document).ready(function() {     $.ajax({         type: "get",         url: "data.txt",         datatype: "text",         success: function(data) {processdata(data);}      }); });     var lines = []; function processdata(alltext) {     var alltextlines = alltext.split(/\r\n|\n/);     var headers = alltextlines[0].split(', ');       (var i=0; i<alltextlines.length; i++) {         var data = alltextlines[i].split(', ');         if (data.length == headers.length) {              var tarr = [];             (var j=0; j<headers.length; j++) {                 tarr.push(data[j]);                 locs[data[j]] = data[j];             }             lines.push(tarr);         };     }; };  for(i = 0; < locations.length; i++) { console.log(lines)     d3.selectall("rect[id='" + string(lines[i][1]) + "']")         .data(locations)         .attr("transform-origin", "bottom")         .attr("y", function(a) {             var current_y = d3.select(this).attr("y")             return current_y - lines[i][1];         })         .attr("height", lines[i][1]); }; 

i know going have stupidly easy answer, , stupid mistake in messy code i've been struggling few days , i've searched nothing worked me.

any ideas?


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -