Browse Source

If data is missing in one of the columns, newer versions of C3 will break in an

unexpected place, which makes it hard to debug. This patch catches the error
early so as to ease debugging.
pull/398/head
Guillaume Ballet 11 years ago
parent
commit
dc972cd7ea
  1. 4
      c3.js

4
c3.js

@ -1552,6 +1552,8 @@
for (i = 1; i < rows.length; i++) {
new_row = {};
for (j = 0; j < rows[i].length; j++) {
if (isUndefined(rows[i][j]))
throw new Error("Source data is missing a component at (" + i + "," + j + ")!");
new_row[keys[j]] = rows[i][j];
}
new_rows.push(new_row);
@ -1566,6 +1568,8 @@
if (isUndefined(new_rows[j - 1])) {
new_rows[j - 1] = {};
}
if (isUndefined(columns[i][j]))
throw new Error("Source data is missing a component at (" + i + "," + j + ")!");
new_rows[j - 1][key] = columns[i][j];
}
}

Loading…
Cancel
Save