Javascript TypeError:rawData[行]未定义

Javascript TypeError:rawData[行]未定义,javascript,jquery,bar-chart,Javascript,Jquery,Bar Chart,我正在创建一个条形图,用jquery加载XML数据。但由于某种原因,我得到了TypeError:rawData[row]是未定义的。这段代码在这里起作用,在第行发生的事情是,它得到一个日期,将日、月、年分割,并将其解析为int。因此,2016年4月21日,它将得到04,并将其解析为int rawData= [ ['Month', 'Identified transaction', 'Identified counterparty, verification needed', 'Unident

我正在创建一个条形图,用jquery加载XML数据。但由于某种原因,我得到了
TypeError:rawData[row]是未定义的
。这段代码在这里起作用,在第行发生的事情是,它得到一个日期,将日、月、年分割,并将其解析为int。因此,2016年4月21日,它将得到04,并将其解析为int

rawData= [
  ['Month', 'Identified transaction', 'Identified counterparty, verification needed', 'Unidentified transaction'],     
  ['Jan', 0, 0, 0],
  ['Feb', 0, 0, 0],
  ['Mar', 0, 0, 0],
  ['Apr', 0, 0, 0],
  ['May', 0, 0, 0],
  ['Jun', 0, 0, 0],
  ['Jul', 0, 0, 0],
  ['Aug', 0, 0, 0],
  ['Sept', 0, 0, 0],
  ['Oct', 0, 0, 0],
  ['Nov', 0, 0, 0],
  ['Dec', 0, 0, 0]
];

<!-- loop for each row -->
xmlData.find('item').each(function(){
    var col;
    var row;

    /* loop for each column */
    $j(this).find('column').each(function(){
        var colID = $j(this).attr("columnid"); 

        /* Get value and store in variable */
        var value = $j(this).find('displayData').text();

        /* Selecting specific column */
        if(colID == columns["Category"]){
          /* Compare value to String element and store the information in the template */
          if(value === "Identified transaction"){
            col = rawData[0].indexOf("Identified transaction");
          }else if(value === "Identified transaction above threshold"){ 
            col = rawData[0].indexOf("Identified transaction");
          }else if(value === "Identified transaction, unidentified type"){
            col = rawData[0].indexOf("Identified transaction");
          }else if(value === "Identified transaction, above cumulative threshold"){ 
            col = rawData[0].indexOf("Identified transaction");
          }else if(value === "Identified transaction, frequency limit"){
            col = rawData[0].indexOf("Identified transaction");
          }else if(value === "Identified transaction, unidentified currency"){
            col = rawData[0].indexOf("Identified transaction");
          }else if(value === "Identified counterparty frequency limit"){ 
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty unidentified type"){ 
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty unidentified amount"){ 
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty, unidentified transaction, above overall threshold"){
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty, unidentified transaction, within overall threshold"){
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty, unidentified amount, above overall threshold"){
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty, unidentified amount, within overall threshold"){
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty, unidentified amount, above overall threshold"){
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Identified counterparty, unidentified amount, within overall threshold"){
             col = rawData[0].indexOf("Identified counterparty, verification needed");
          }else if(value === "Unidentified transaction"){
            col = rawData[0].indexOf("Unidentified transaction");
          }else if(value === "Unidentified counterparty"){
            col = rawData[0].indexOf("Unidentified transaction");
          }else if(value === "Unidentified transaction, within overall threshold"){
            col = rawData[0].indexOf("Unidentified transaction");
          }
        }
        <!-- dividing the data so it does not end up all in 1 bar. The divider here is the date of when an transaction was created -->
        else{
          var date = $j(this).find('displayData').text();
          var res = date.split("/");
          row = parseInt(res[1]);
        }
    })

    rawData[row][col]++;
})

drawStacked(rawData);

我在这里做错了什么?

只有在进入else时才定义行block@kylestephens这是在一个else块内。“我会更新它的,修好了吗?”kylestephens,就像我说的,它已经在另一个街区了。所以这不是导致错误的原因。。。
else{
var ID;
if(value == "Jan"){
  ID = 1;
} if(value == "Feb"){
              ID = 2; 
} if(value == "Mar"){
  ID = 3;
} if(value == "Apr"){
  ID = 4;
} if(value == "May"){
  ID = 5;
} if(value == "Jun"){
  ID = 6;
} if(value == "Jul"){
  ID = 7;
} if(value == "Aug"){
  ID = 8;
} if(value == "Sept"){
  ID = 9;
} if(value == "Oct"){
  ID = 10;
}
row = ID;
}