Uncaught Error: Row 29 has 1 columns, but must have 32
I'm trying to get some CSV data into a DataTable in order to create a line graph. The CSV has gone through a function to clean up the data prior to creating a new DataTable, the variable data2Array.
I only want to access 5 of the columns from data2Array. When I try to add a new row with the 5 data values, I get the following exception:
Uncaught Error: Row 29 has 1 columns, but must have 32
This has me confused, because I can see I've only tried to add the one row to data2Table, supplying only the 5 aforementioned values. Here is the log of what the row looks like:
0, Jul 1 2015, 3.379, 6.57, 0
data2Array has 32 columns and 29 rows, but in my DataTable, I've only specified for 5 columns before attempting to add a row. Since I am not adding anything to the original data source, but rather to data2Table, why is the exception mentioning row 29 or needing 32 columns? My new DataTable has been specified with only 5 columns.
Below is the code I am working with currently:
var data2Array = fullDataArray(csvData2);
console.log("data2 clean: " + data2Array);
// request line graph - data2
var data2Table = new google.visualization.DataTable(data2Array);
data2Table.addColumn('number', 'colIndex');
data2Table.addColumn('string', 'colLabel1');
data2Table.addColumn('string', 'colLabel2');
data2Table.addColumn('string', 'colLabel3');
data2Table.addColumn('string', 'colLabel4');
var testArr = [0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]];
console.log('test: ' + testArr);
data2Table.addRow([0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]]);
datatable google-chartwrapper linegraph
add a comment |
I'm trying to get some CSV data into a DataTable in order to create a line graph. The CSV has gone through a function to clean up the data prior to creating a new DataTable, the variable data2Array.
I only want to access 5 of the columns from data2Array. When I try to add a new row with the 5 data values, I get the following exception:
Uncaught Error: Row 29 has 1 columns, but must have 32
This has me confused, because I can see I've only tried to add the one row to data2Table, supplying only the 5 aforementioned values. Here is the log of what the row looks like:
0, Jul 1 2015, 3.379, 6.57, 0
data2Array has 32 columns and 29 rows, but in my DataTable, I've only specified for 5 columns before attempting to add a row. Since I am not adding anything to the original data source, but rather to data2Table, why is the exception mentioning row 29 or needing 32 columns? My new DataTable has been specified with only 5 columns.
Below is the code I am working with currently:
var data2Array = fullDataArray(csvData2);
console.log("data2 clean: " + data2Array);
// request line graph - data2
var data2Table = new google.visualization.DataTable(data2Array);
data2Table.addColumn('number', 'colIndex');
data2Table.addColumn('string', 'colLabel1');
data2Table.addColumn('string', 'colLabel2');
data2Table.addColumn('string', 'colLabel3');
data2Table.addColumn('string', 'colLabel4');
var testArr = [0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]];
console.log('test: ' + testArr);
data2Table.addRow([0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]]);
datatable google-chartwrapper linegraph
If you're adding completely new data into a new table structure, shouldn't the 'new' call at the var data2Table line be an empty initialization, rather than being constructed against data2Array? ie, var data2Table = new google.visualization.DataTable();
– Paul Beverage
Nov 20 at 15:47
I believe that's true, I've tested that, but I'm getting the same error :/
– Melody Anoni
Nov 20 at 16:19
Are you certain that the data2Table.addrow() call is the one generating the exception? If anything, I would think the addrow() call would generate an exception about only having 5 columns, not 1 column. Also, can you add the output of the two console.log statements?
– Paul Beverage
Nov 20 at 16:32
1
first, @Paul is correct, there should be no arguments to theDataTable
constructor, unless being initialized by JSON, as found here -- next, the data format forLineChart
only allows the first column, the x-axis, to be a'string'
column -- if you could please provide a sample of the data, before or after the conversion, it would be easier to diagnose the problem...
– WhiteHat
Nov 20 at 19:58
@WhiteHat Thanks for that -- I thought I had posted a follow-up to ask for the data -- but I must have forgotten it -- too many browser windows, not enough brain for them all.
– Paul Beverage
Nov 20 at 20:09
add a comment |
I'm trying to get some CSV data into a DataTable in order to create a line graph. The CSV has gone through a function to clean up the data prior to creating a new DataTable, the variable data2Array.
I only want to access 5 of the columns from data2Array. When I try to add a new row with the 5 data values, I get the following exception:
Uncaught Error: Row 29 has 1 columns, but must have 32
This has me confused, because I can see I've only tried to add the one row to data2Table, supplying only the 5 aforementioned values. Here is the log of what the row looks like:
0, Jul 1 2015, 3.379, 6.57, 0
data2Array has 32 columns and 29 rows, but in my DataTable, I've only specified for 5 columns before attempting to add a row. Since I am not adding anything to the original data source, but rather to data2Table, why is the exception mentioning row 29 or needing 32 columns? My new DataTable has been specified with only 5 columns.
Below is the code I am working with currently:
var data2Array = fullDataArray(csvData2);
console.log("data2 clean: " + data2Array);
// request line graph - data2
var data2Table = new google.visualization.DataTable(data2Array);
data2Table.addColumn('number', 'colIndex');
data2Table.addColumn('string', 'colLabel1');
data2Table.addColumn('string', 'colLabel2');
data2Table.addColumn('string', 'colLabel3');
data2Table.addColumn('string', 'colLabel4');
var testArr = [0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]];
console.log('test: ' + testArr);
data2Table.addRow([0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]]);
datatable google-chartwrapper linegraph
I'm trying to get some CSV data into a DataTable in order to create a line graph. The CSV has gone through a function to clean up the data prior to creating a new DataTable, the variable data2Array.
I only want to access 5 of the columns from data2Array. When I try to add a new row with the 5 data values, I get the following exception:
Uncaught Error: Row 29 has 1 columns, but must have 32
This has me confused, because I can see I've only tried to add the one row to data2Table, supplying only the 5 aforementioned values. Here is the log of what the row looks like:
0, Jul 1 2015, 3.379, 6.57, 0
data2Array has 32 columns and 29 rows, but in my DataTable, I've only specified for 5 columns before attempting to add a row. Since I am not adding anything to the original data source, but rather to data2Table, why is the exception mentioning row 29 or needing 32 columns? My new DataTable has been specified with only 5 columns.
Below is the code I am working with currently:
var data2Array = fullDataArray(csvData2);
console.log("data2 clean: " + data2Array);
// request line graph - data2
var data2Table = new google.visualization.DataTable(data2Array);
data2Table.addColumn('number', 'colIndex');
data2Table.addColumn('string', 'colLabel1');
data2Table.addColumn('string', 'colLabel2');
data2Table.addColumn('string', 'colLabel3');
data2Table.addColumn('string', 'colLabel4');
var testArr = [0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]];
console.log('test: ' + testArr);
data2Table.addRow([0, data2Array[0][0],data2Array[0][4], data2Array[0][5], data2Array[0][7]]);
datatable google-chartwrapper linegraph
datatable google-chartwrapper linegraph
edited Nov 21 at 1:25
Paul Beverage
249214
249214
asked Nov 20 at 15:34
Melody Anoni
348
348
If you're adding completely new data into a new table structure, shouldn't the 'new' call at the var data2Table line be an empty initialization, rather than being constructed against data2Array? ie, var data2Table = new google.visualization.DataTable();
– Paul Beverage
Nov 20 at 15:47
I believe that's true, I've tested that, but I'm getting the same error :/
– Melody Anoni
Nov 20 at 16:19
Are you certain that the data2Table.addrow() call is the one generating the exception? If anything, I would think the addrow() call would generate an exception about only having 5 columns, not 1 column. Also, can you add the output of the two console.log statements?
– Paul Beverage
Nov 20 at 16:32
1
first, @Paul is correct, there should be no arguments to theDataTable
constructor, unless being initialized by JSON, as found here -- next, the data format forLineChart
only allows the first column, the x-axis, to be a'string'
column -- if you could please provide a sample of the data, before or after the conversion, it would be easier to diagnose the problem...
– WhiteHat
Nov 20 at 19:58
@WhiteHat Thanks for that -- I thought I had posted a follow-up to ask for the data -- but I must have forgotten it -- too many browser windows, not enough brain for them all.
– Paul Beverage
Nov 20 at 20:09
add a comment |
If you're adding completely new data into a new table structure, shouldn't the 'new' call at the var data2Table line be an empty initialization, rather than being constructed against data2Array? ie, var data2Table = new google.visualization.DataTable();
– Paul Beverage
Nov 20 at 15:47
I believe that's true, I've tested that, but I'm getting the same error :/
– Melody Anoni
Nov 20 at 16:19
Are you certain that the data2Table.addrow() call is the one generating the exception? If anything, I would think the addrow() call would generate an exception about only having 5 columns, not 1 column. Also, can you add the output of the two console.log statements?
– Paul Beverage
Nov 20 at 16:32
1
first, @Paul is correct, there should be no arguments to theDataTable
constructor, unless being initialized by JSON, as found here -- next, the data format forLineChart
only allows the first column, the x-axis, to be a'string'
column -- if you could please provide a sample of the data, before or after the conversion, it would be easier to diagnose the problem...
– WhiteHat
Nov 20 at 19:58
@WhiteHat Thanks for that -- I thought I had posted a follow-up to ask for the data -- but I must have forgotten it -- too many browser windows, not enough brain for them all.
– Paul Beverage
Nov 20 at 20:09
If you're adding completely new data into a new table structure, shouldn't the 'new' call at the var data2Table line be an empty initialization, rather than being constructed against data2Array? ie, var data2Table = new google.visualization.DataTable();
– Paul Beverage
Nov 20 at 15:47
If you're adding completely new data into a new table structure, shouldn't the 'new' call at the var data2Table line be an empty initialization, rather than being constructed against data2Array? ie, var data2Table = new google.visualization.DataTable();
– Paul Beverage
Nov 20 at 15:47
I believe that's true, I've tested that, but I'm getting the same error :/
– Melody Anoni
Nov 20 at 16:19
I believe that's true, I've tested that, but I'm getting the same error :/
– Melody Anoni
Nov 20 at 16:19
Are you certain that the data2Table.addrow() call is the one generating the exception? If anything, I would think the addrow() call would generate an exception about only having 5 columns, not 1 column. Also, can you add the output of the two console.log statements?
– Paul Beverage
Nov 20 at 16:32
Are you certain that the data2Table.addrow() call is the one generating the exception? If anything, I would think the addrow() call would generate an exception about only having 5 columns, not 1 column. Also, can you add the output of the two console.log statements?
– Paul Beverage
Nov 20 at 16:32
1
1
first, @Paul is correct, there should be no arguments to the
DataTable
constructor, unless being initialized by JSON, as found here -- next, the data format for LineChart
only allows the first column, the x-axis, to be a 'string'
column -- if you could please provide a sample of the data, before or after the conversion, it would be easier to diagnose the problem...– WhiteHat
Nov 20 at 19:58
first, @Paul is correct, there should be no arguments to the
DataTable
constructor, unless being initialized by JSON, as found here -- next, the data format for LineChart
only allows the first column, the x-axis, to be a 'string'
column -- if you could please provide a sample of the data, before or after the conversion, it would be easier to diagnose the problem...– WhiteHat
Nov 20 at 19:58
@WhiteHat Thanks for that -- I thought I had posted a follow-up to ask for the data -- but I must have forgotten it -- too many browser windows, not enough brain for them all.
– Paul Beverage
Nov 20 at 20:09
@WhiteHat Thanks for that -- I thought I had posted a follow-up to ask for the data -- but I must have forgotten it -- too many browser windows, not enough brain for them all.
– Paul Beverage
Nov 20 at 20:09
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396419%2funcaught-error-row-29-has-1-columns-but-must-have-32%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396419%2funcaught-error-row-29-has-1-columns-but-must-have-32%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you're adding completely new data into a new table structure, shouldn't the 'new' call at the var data2Table line be an empty initialization, rather than being constructed against data2Array? ie, var data2Table = new google.visualization.DataTable();
– Paul Beverage
Nov 20 at 15:47
I believe that's true, I've tested that, but I'm getting the same error :/
– Melody Anoni
Nov 20 at 16:19
Are you certain that the data2Table.addrow() call is the one generating the exception? If anything, I would think the addrow() call would generate an exception about only having 5 columns, not 1 column. Also, can you add the output of the two console.log statements?
– Paul Beverage
Nov 20 at 16:32
1
first, @Paul is correct, there should be no arguments to the
DataTable
constructor, unless being initialized by JSON, as found here -- next, the data format forLineChart
only allows the first column, the x-axis, to be a'string'
column -- if you could please provide a sample of the data, before or after the conversion, it would be easier to diagnose the problem...– WhiteHat
Nov 20 at 19:58
@WhiteHat Thanks for that -- I thought I had posted a follow-up to ask for the data -- but I must have forgotten it -- too many browser windows, not enough brain for them all.
– Paul Beverage
Nov 20 at 20:09