Chart does not graph from Spreadsheet

Hello everyone.
I am competing the the Appathon and and am having trouble trying to graph data from a spreadsheet. So far, I have had no problem editing the sheet from the app and viewing individual cells. I tried following this tutorial too: Data in Action: Using Spreadsheets and Charts in MIT App Inventor - Google Docs

Here is what the spreadsheet looks like:


And here is what the code looks like:

Here is what the Designer looks like for ChartData2D2

The problem occurs when I press the GenerateGraphs Button. The app on my phone says Error4101: InvalidChartEntry Value(s): 155,. I know I have not put the blocks inside of a GotSheetData event, but that is because that event is already being used somewhere else and the documentation states that the use of the event is not necessary. I tried with it and I still get the exact same Error4101.

I cannot for the life of me figure this out, so any help is greatly appriciated. TIA

In your sheet, the Month column has these mysterious text values 'Jan', 'Feb', ... in them.

The graphdata component was expecting numbers like 1,2,...

1 Like

Hmmm that seems to work! However, this means that I have to use numbers for all of the months and the headers at the top (ex. Months, Income, Savings, etc.) cannot be text either. Is there a way to have the text but be ignored? I don't want to use extensions as that means extra permissions and all, but worst case, I could scrap the whole viewing and try to figure something else out. I see that the blocks have readSheet, readRow, and readColumn, but is there a way to exclude the first row? (OK I think I figured out ignoring the test for Months, Income, Savings etc. by using the headers in the designer properties for the chart2D2, but is it possible to do it for Jan, Feb, Mar?)

Additionally, on the graph itself when it graphs, the increments for the axis counts by 1, leading to the numbers overlapping each other. Is there a way to increase the increment to something like 5 or 10?

But the chartData ImportFromSpreadsheet block respected the headings, and used them because you gave a true value for the useHeaders parameter (unfortunately undocumented.)

If that can't handle header rows, I would like to see that, for a bug report.

If you use alternative methods to feed your chart, like a csv download,
remove item (row) 1 from the table (list of lists) before graphing the data.

Maybe a bar chart instead of a line graph?

Or use numeric internal format in the spreadsheet for your month (days from 1899 is the standard for spreadsheets) . Search this board for '1899' for discussion of that.

The ChartData subcomponent has many possible inputs, including plain old AI2 lists and tables (lists of lists). That makes it possible to download your desired data with a Get Range block, requesting just the lower part of the data (i.e. A2:B13) and post processing the download to map month names into month numbers before loading the post processed table into the ChartData.

Also, if you add extra Spreadsheet components and name them appropriately, you can get more targeted completion events, for example by sheet or context or operation.

Or use google Charts in a Webview (no extension required)